Home » Linux » Using iconv to convert from UTF-16LE to UTF-8

Using iconv to convert from UTF-16LE to UTF-8

Posted by: admin November 30, 2017 Leave a comment

Questions:

Hi I am trying to convert some log files from a Microsoft SQL server, but the files are encoded using UTf-16LE and iconv does not seem to be able to convert them.

I am doing:

iconv -f UTF-16LE -t UTF-8 <filename>

I also tried to delete any carriage returns from the end of the line if there are any, but that did not fix it either. If I save it using gedit that works, but this is not a viable solution since I have hundreds of those files.

Thanks!

Answers:

I forgot the -o switch!

The final command is :

iconv -f UTF-16LE -t UTF-8 <filename> -o <new-filename>

Leave a Reply

Your email address will not be published. Required fields are marked *