putty, utf8 and chinese

I often have to edit utf8 encoded files that contain Chinese, on remote linux machine, through putty. To edit and display Chinese correctly, I have to configure putty and my environment setting on the remote host.

First putty:open putty configuration Window -> appearance -> font settints->change... select NSimSun (新宋体)
Window -> Translation -> Character set ... select UTF-8

Save configuration to a session.
Next we setting up remote host:
put this in ~/.bashrc
export LANG=en_US.UTF-8

Re-"source" bashrc.

Issue a "locale" and make sure LC_CTYPE is set correctly. If not do a "locale -a" and see what's available.
In Fedora or CentOS, just do a "yum install glibc-common" to install glibc-common to get all locales.
In Ubuntu, edit file /var/lib/locales/supported.d/local and add this line:
en_US.UTF-8 UTF-8
Then do a "dpkg-reconfigure locales".

That's it. Now we can edit UTF8 encoded Chinese file without problem.


Anonymous said...

It works. Thanks.

Unknown said...

Wow, this worked!


jzhou002 said...

Nice job, thanks.

Anonymous said...

I am not able to find the 'NSimSun' font in the list that we get when we are in change font settings...
Can you help me here ?

Anonymous said...

I have Translation set to UTF-8, don't have NSimSun, here is my .bash_profile

# ~/.bash_profile: executed by bash(1) for login shells.
umask 002
PS1='[\h]$ '
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

Anonymous said...

env settings already used UTF8. only changed the putty characterset; not the font. thanks

falu said...

You must have chinese keyboard because putty gets the character sets from the keyboard settings.

Unknown said...

As a young boy, Dhamaraksa is said to have travelled to many countries in the Western Regions and learned Central Asian languages and scripts. Translator in Beijing

Yogesh said...

This is an awesome post. Really very informative and creative contents. This concept is a good way to enhance knowledge. I like it and help me to development very well. Thank you for this brief explanation and very nice information. Well, got good knowledge.
WordPress website development Chennai