utf 8 - How can I programmatically change file encoding linux? -
Is there a program to change file encoding to the UTF-8 program? I have 1000 files and I want to save them in linux in UTF-8 format.
Thanks
Will take care of that, use it like this:
Iconv -f ISO88591 -t UTF8 in.txt out.txt
Where is the encoding for 88591
, the most common 8- One of the bit encodings, which might (or may not) be your input encoding.
If you do not know the input charset with the input command or dragon based, for example:
iconv -f $ (file -b myfile.txt | Sed -e 's /.* [] charset = //') -t UTF8 in.txt out.txt
You want to make this stronger than a liner, such as Encoding is unknown, do not process files.
From here, to override multiple files, you can do something like
find -name * .txt -exec iconv -f ISO88591 -t UTF8 { } {} \;
I have not checked this, so you can find and find Google icon, read about them here, or just read your man page.
Comments
Post a Comment