Archive for March 6th, 2009
Fix Japanese File Name on Linux
by z3n on Mar.06, 2009, under Linux Happyness
Problem:
Japanese filenames are screwed up on linux, when you try to copy them to windows their encoding is different. Or when you write them on linux and want to use on a windows machine or even by http or ftp they are all wrong.
Solution:
Apart from all the encoding mess, apparently linux encodes filenames as UTF-16 which is different from windows’ UTF-8 default, i say apparently because all the programs i used to test the charset on the linux stated that it was UTF-8 actually, which contradicts all the sites about linux’s default charset being UTF-16 … but this is just lame, basically what you need to do is convert the file names to Shift_JIS which is the most compatible format for windows, i wrote a php script to fix a folder or even the whole tree if you want. the source:
http://www.overflow.biz/blog/~scripts/convert2shift_jis.phps
by default this script will only rename the files it’s into, but you can easly tune it up to rename everything.