Getting cnchess to properly display Chinese characters
Posted by Fred Muller
For those of you knowing how to play Chinese chess there is a Chinese application (Qt based) which is installed by default in Red Flag Linux and works very well in Chinese, but which unfortunately doesn’t install so well in other distributions. A quick Google search will give you a place to find both the binaries and the source code and even the developer’s contact details, however they both have been made on a platform using ‘Western ISO-8859-15’ GB-18030 encoding and will not display Chinese characters probably (you’ll get garbage) on your modern UTF-8 distribution. I guess the developer might be using Windows (or an old distro?) and one of the advantages of the Qt framework is cross platform development. So now one way to fix this problem could be to convert the source files to UTF-8 and recompile or repackage. Encoding conversion can be done using the iconv command and a bash script: (thanks worufu) #!/bin/bash
for file in `ls`
do iconv -f ISO-8859-15 -t UTF-8 -o "new_$file" "$file"
iconv -f GB18030 -t UTF-8 -o "new_$file" "$file"