Introduction
iconv is used for character set conversion facility. With this command, you can turn a string represented by a local character set into the one represented by another character set, which may be the Unicode character set. Supported character sets depend on the iconv implementation of your system. Note that the iconv function on some systems may not work as you expect. In such case, it'd be a good idea to install the » GNU libiconv library. It will most likely end up with more consistent results.
Detail
The basic command is:
iconv -f old-encoding -t new-encoding file.txt > newfile.txt
You can get a list of supported encodings with (that's a lower-case L, not a one):
iconv -l
Example
iconv -f ISO-8859-1 -t UTF8 sample.txt > sample.txt
Resources
- The official iconv man page.
- For Linux users who don't have it in their distribution, the iconv source is available from GNU.
No comments:
Post a Comment