Linux, Xterm, and VIM localization behavior of setenv LANG vs. setenv LC_CTYPE

为君一笑 提交于 2019-12-13 05:05:11

问题


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.

来源:https://stackoverflow.com/questions/17039705/linux-xterm-and-vim-localization-behavior-of-setenv-lang-vs-setenv-lc-ctype

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!