jueves, 26 de enero de 2017

Visualise and modify the character encoding of a file

To see the character encoding of a file use the command "file" with the option -i or --mime. This shows the mime (Multipurpose Internet Mail Extensions) type strings. In the following example, we see the charset of an index.html file

$ file -i ./index.html
./index.html: text/html; charset=iso-8859-1

We can use the command "iconv" to convert the encoding of a given file from one encoding to another. In the next example from iso-8859-1 to utf-8

$ iconv -f ISO-8859-1 -t UTF-8 index.html -o index.html

where -f is --from-code, -t is --to-code and -o is --output

source: http://stackoverflow.com/questions/11316986/how-to-convert-iso8859-15-to-utf8

No hay comentarios:

Publicar un comentario