0

I am writing some perl scripts to process some files with Japanese names and contents. I wanted to see the file names when I do ls in xterm, instead of garbage characters.

Here is my configuration: Client OS:

Windows XP Japan

Server:

Red Hat Enterprise Linux Server release 6.2

VIM : VIM version 7.2.411

Xterm : ASTEC-X version 6.0

CSH: tcsh 6.17.00 (Astron)

After I updated my .cshrc to use setenv LANG ja_JP.UTF.8, and re-open my xterm window, it was really hard for me to back out because of the following:

1) In VIM, I would try to open the .cshrc file, and delete a comment line above by pressing backspace, but instead the line below the cursor disappear, and then the top line is copied. All the VI errors are in garbage characters.

2) I could not back up my file in shell, and I also get unreadable error.

[someguy@simunec1 ~]$ copy .cshrc .cshrc.bak
copy:   -Ac3c3cch&c$ccc>c  (B.
[someguy@simunec1 ~]$ 1;2c

3) I could not use visual mode in VIM to copy the entire content of .cshrc (somehow only the beginning parts gets to the clipboard).

4) Eventually, I managed to get the pieces I want to back out in my .cshrc in the clipboard before deleting most of it and reloading xterm.

Questions:

1) Anyone can help explained what just happened above?

2) I later found another source that suggested setenv LC_CTYPE ja_JP.UTF-8 (https://unix.stackexchange.com/questions/16771/foreign-characters-wont-display-in-ssh). It gave me the ability to see the files in Japanese when I do ls, while keeping the vim and shell error messages in English, and I can see also the Japanese characters in VIM in my perl scripts. Pressing backspace in VIM doesn’t result in the cursor jumping about and new lines being pasted. Somehow I got the best of both worlds, and I am not sure why that works and set LANUG doesn't, although the font for the English characters has become bulky, and it is hard to program in.

Thanks.

Community
  • 1
  • 1
frank
  • 1,283
  • 1
  • 19
  • 39
  • 1
    1) Run `locale -a` to make sure you have a locale called `en_US.utf8`. 2) Set LANG to `en_US.utf8`. 3) Run `xterm` with the `-u8` switch. (might not be necessary) – Joni Jun 11 '13 at 10:09
  • Setting the flag to en-US.utf8 would not help my situation, as I am trying to get Japanese characters to display in Xterm. And setenv LANG to ja_JP.UTF-8 started to mess things up like I described above. – frank Jun 12 '13 at 00:57
  • If you want a user interface in English and using the UTF-8 encoding you have to use en_XX.utf8 (XX being your variant of choice: US,UK,CA,AU,NZ,..). I wouldn't recommend setting `LC_CTYPE` to Japanese because it affects sorting order and case conversions, not only text encoding. Despite being instructed to talk to you in English, programs will try their best to show all characters. Xterm may not have the best font support in the world; you may have more luck with rxvt or gnome-terminal. – Joni Jun 13 '13 at 08:00

0 Answers0