Thursday, April 4, 2019

Linux: Convert a file with UTF-16 encoding to ASCII encoding


We use command iconv to convert the file's encoding.

iconv -f UTF-16 -t ASCII input.txt -o output.txt

We can append string //TRANSLIT to ASCII which means if a character cannot be converted, a similar looking character will be used to represent that character or a question mark (?) is used.

iconv -f UTF-16 -t ASCII//TRANSLIT input.txt -o output.txt

No comments:

 
Get This <