Getting cnchess to properly display Chinese characters

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"
done

Compiling requires you to read the README file shipped with the source code and use the make and configure tools.

Another way is to look for the Red Flag Linux rpm (thank you again Google) which latest version is available on Red Flag Linux FTP and install it. Should you use a Debian based distribution there is a existing deb package on Ubuntu China forum which suffers from the same problem, so your best bet is to convert the already fetched rpm package to a debian one using Alien, and you’re done (still need to install it though). I’ve uploaded the final working (in Chinese) debian package right here to save the hassles to others. For MIPS computers users such as the Gdium, I’ll upload the rpm once it’s done to our community repository soon.