UP | HOME
Ravi Sagar | Home | Blog

Unable to convert to UTF-8 encoding on linux?

Try this shell script.

#!/bin/sh
# send character-string to enable UTF-8 mode
if test ".$1" = ".off" ; then
    printf '\033%%@'
else
    printf '\033%%G'
fi

source: https://unix.stackexchange.com/questions/303712/how-can-i-enable-utf-8-support-in-the-linux-console

Then convert the encoding.

iconv -f us-ascii -t UTF-8 songs.txt >> list.txt

Then check the encoding of the file.

file - list.txt

It will show you the following.

list.txt: text/plain; charset=utf-8