2012年6月15日 星期五

[Ubuntu] show directory/file name mixed with Japanese and Chinese correctly in Terminal

I have a samba server sharing a disk with directories/files name mixed with Japanese and Chinese. My Ubuntu 10.04 which mount the disk just show a bunch of "???" or other mystic characters.



The option "iocharset" given to "mount" plays a critical role to have folder/file name display correctly.
"iocharset=cp950" with "LANG=zh_TW.big5".
"iocharset=cp932" with "LANG=ja_JP.shiftjis"
"iocharset=utf8" with "LANG=zh_TW.utf8" and "LANG=en_US.utf8" (I guess all XXX.utf8 would work)
UTF8 is most suggested to be used.

To Install a new locale:
$ sudo ./install-language-pack EUC-JP
$ sudo locale-gen ja_JP.EUC-JP
Generating locales...
ja_JP.EUC-JP... done
Generation complete.
$ locale -a
(.......)
en_ZW.utf8
ja_JP.eucjp
ja_JP.utf8
tt_RU
(.......)

Configure the Terminal
After the locale is installed/configured properly, you need to change the Terminal's default locale:
LANG=ja_JP.utf8
or
LANG=ja_JP.eucjp
(Just temporarily, or make the changes to /etc/environment for permanent change)
And the Character Encoding:
[Terminal] -> [Set Character Encoding] -> [Japenease (EUC-JP)] or the one that match the LANG setting.


commands:
locale -a
locale-gen
/usr/share/locales/install-language-pack

files:
/var/lib/locales/supported.d/local
/etc/environment
/etc/default/locale
/usr/share/i18n/SUPPORTED



LocaleConf - Community Ubuntu Documentation
https://help.ubuntu.com/community/LocaleConf
For Anti-UTF-8 people
https://help.ubuntu.com/community/LocaleConf#For_Anti-UTF-8_people
See the first column of the file /usr/share/i18n/SUPPORTED and identify your language codes, example: en_US es_VE pt_BR es_ES. Note that the second column shows the encoding to be used with that language code and remember that we don't want UTF-8 as encoding.

After you know which language codes you will use, go to the terminal and type the following:

$ sudo locale-gen LANG1 LANG2 LANG3 ...

Where LANG1, LANG2, ... are the language code you selected. As an example, a user in Venezuela may want:

$ sudo locale-gen es_VE en_US

After that, you should reboot your computer.


Running the Platform in another language - Pentaho Engineering - Pentaho Wiki
http://wiki.pentaho.com/display/PEOpen/Running+the+Platform+in+another+language
Instructions for setting up Japanese Shift_JIS charset on Ubuntu Linux:

1. Install the language pack:
$ sudo apt-get install language-pack-gnome-ja language-pack-ja
2. List the currently installed locale's
$ locale -a
3. We need to add the following to /var/lib/locales/supported.d/local
ja_JP.SHIFT_JIS SHIFT_JIS
4. List the available charsets
$ locale -m
You should see SHIFT_JIS in the list
5. Compile the ja_JP.shiftjis locale
$ sudo localedef -f SHIFT_JIS -i ja_JP ja_JP.Shift_JIS
6. List the currently installed locales to see if our new one is now available
$ locale -a


Ubuntuでlocaleを設定する。 - redtower's memo
http://redtower.plala.jp/2010/06/06/ubuntu-locale.html

HOWTO: Install a new locale (language pack) - Ubuntu Forums
http://ubuntuforums.org/showthread.php?t=196414

沒有留言: