Convert UTF-16 file to UTF-8
- February 20th, 2013
- Posted in Documentation
- Write comment
A lot of times, I find myself creating output files in Windows that I want to use linux to parse because I am more comfortable scripting in linux than in Windows. Most times I the output UTF-16 encoded. You can tell by using the file command. I used this to convert a file generated in Windows 2003 server, so that I could work with it in CentOS 6.x.
$ file myfilename.txt
myfilename.txt: Little-endian UTF-16 Unicode text, with CRLF line terminators
Then, to convert the file:
$ iconv -f utf-16 -t utf-8 myfilename.txt > mynewfilename.txt
Thanks. I was wondering how to read some EAC log files that were unreadable on the console with cat or less.
This page made it a quick job for me.
Cheers