Sunday, November 21, 2010

How can my bash script output Unicode?

Finally I found how to print Unicode characters from a bash script: http://forums.debian.net/viewtopic.php?f=10&t=45394

Here is the code from 'hedgie' that works for me:

for dec in {9472..9599} ; do
    hex=`echo "ibase=10; obase=16; $dec" | bc`
    /usr/bin/printf \\u$hex
done

No comments:

Post a Comment