Wednesday, December 24, 2008

Chinese filename in Linux and Samba for Windows share

Ok, so there was some old files with Chinese characters that I have in the harddrive with GB2312 encoding, they were downloaded by Azeureus in my gentoo build, but after I installed Ubuntu 8.10 (Intrepid Ibex), they don't show up correctly, but they show ok on Samba viewed from Windows machine. On the other hand, the files with Chinese characters created under Ubuntu was not recognized in Samba. After a lot of googling and fiddling around, I finally got it working correctly both ways:
1. In Ubuntu, I need to do
sudo apt-get install convmv
convmv -r -f gb2312 -t utf8 --notest --nosmart *
to convert all filenames to utf8 encoding.
2. In smb.conf, I need
display charset = cp936
dos charset = 936
unix charset = utf-8
Voila, everything works.