Monday, 8 January 2007

Converting a file's encoding

Handling files that are in the wrong encoding (e.g. Unicode, little-endian) can be a major pain, especially on Windows systems.

Unix comes to the rescue here with the iconv tool, which ships with Ruby.

e.g.
iconv.exe -c -s -f UCS-2LE -t UTF-8 wrong-enc.txt > correct-enc.txt

No comments: