3

On Red Hat Enterprise Linux AS release 3,

I've set my environment variable as below

$ echo $LANG
zh_CN.UTF-8

$ echo $LANGUAGE
zh_CN.UTF-8

$ echo $SUPPORTED
en_US.UTF-8:en_US:en:zh_CN.UTF-8

$ locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8

Meanwhile I've set PuTTY's transmission encoding as utf-8 and appearance->font setting to have a font as 'Fixedsys' which does support chinese.

However, when I try to print a file with Chinese, it can not print it correctly

$ cat 1.txt
hello▒▒▒ $

and I can not input Chinese correctly on shell.

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109
hetaoblog
  • 249
  • 1
  • 3
  • 14

1 Answers1

0

If you're using screen you must start it with the -U option in order to have utf8 support.

It seems like defutf8 on in your .screenrc should do this for you, but it won't.

DerfK
  • 19,493
  • 2
  • 38
  • 54
  • I'm not using screen; i tried to run screen -U and cat 1.txt, it's still not printing it. – hetaoblog Nov 05 '12 at 02:40
  • @hetaoblog Not sure then. The putty settings you've given allow me to produce Chinese characters if screen is not running, or with `screen -U`. Are you running some other program like `tmux` (which uses `-u`)? – DerfK Nov 05 '12 at 17:06
  • I'm not running tmux. i just login putty and do the settings. on my personal linux, i modified /etc/sysconfig/i18n to set LANG/LANGUAGE/SUPPORTED/SYSFONT to include chinese characters and it worked; for the machine which i do not have permission to do so, I assume it should be fine to set the environment variables there. but it turned out not working... – hetaoblog Nov 06 '12 at 04:07
  • @hetaoblog I think the best bet then is to try comparing `env` on both servers and figuring out what's different. I use Debian and can't find any good docs on what exactly the settings in `/etc/sysconfig/i18n` *DO* and how they are used, and I'm not finding anything there that should interfere. The settings in there don't seem to be environment variables though. I found a webpage that suggests that you can have per-user i18n settings in `~/.i18n` so maybe you can try creating a file named that with those commands and logging out and back in again. – DerfK Nov 06 '12 at 05:35
  • thx very much for your kind help. i tried to create the file but it did not work either. the 2 servers are in 2 different environment that i can not access at the same time. I'll try to look for some other ways. someone said i need to install something like 'zhcon' in order to support chinese, but this does not match with my personal experience on my personal linux server. – hetaoblog Nov 07 '12 at 02:24
  • @hetaoblog Sorry I couldn't fix it. `zhcon` is for the local terminal display, not over ssh. – DerfK Nov 07 '12 at 02:49
  • anyway thx very much for your kind help. so many times that I was moved by the many kind people like you on the SO network – hetaoblog Nov 07 '12 at 03:55