Recodificar la codificación de carácteres de un fichero desde la CLI / Recode files char codification from CLI
* ENGLISH / INGLÉS * Sometimes we find some files (bash scripts, python code, or a simply plain-text file) which does not have the charset we expect and we need to easily recode it from command line. For this issues, we can use 2 tools which I usually forget: iconv and recode. This last one, does not come installed by default (iconv comes with libc6) and we'll have to install it (apt-get install recode). I'll give some examples below :]
* SPANISH / ESPAÑOL * Algunas veces nos encontramos con algún fichero bien sea un script en bash, un python o un simple fichero de texto que no tiene la codificación deseada y necesitamos cambiarla desde la consola, para esto podemos usar 2 utilidades cuyos nombres habitualmente olvido: iconv y recode. Este último no viene instalado por defecto en el sistema (iconv viene con libc6) y habremos de instalarlo (apt-get install recode). A continuación un par de ejemplos :]
# list iconv supported charsets / listar codificaciones soportadas iconv -l # recode a file / convertir un fichero a una codificación con iconv iconv -t UTF-8 file.txt -o output-file # TODO: recode explanation :]
Lenguaje:
bash
