Saturday, May 12, 2012

[HOW TO] Determine and change character file encoding

Determine file encoding:

file -bi some_file

Change file encoding:

iconv -f current_encoding -t destination_encoding file > file_new_encoding

List known coded character sets:

iconv --list

Convert with Vim (eg, converting to utf-8):

:write ++enc=utf-8 file_name

References

Stackoverflow - How can I change a file's encoding with vim?
Determine and change file character encoding
iconv manpage

No comments:

Post a Comment