# How do I display chinese file names under the console?

## vagus

I have couple of files on my /home dir with chinese names. I can read the chinese filenames under gnome and gnome-terminal without any problem.

But when I go into system console or when I remotely login to my computer through SSH with PuTTY, all I get are ???????????????? for the filenames. This becomes somewhat an irritation because I can't identify my chinese filenames remotely...

I basically followed this guide: http://www.gentoo.org/doc/en/utf-8.xml

But it didn't help me anyway. Can somebody please help? Thank you!

----------

## EricHsu

Please take a look at this thread (written in Chinese).

AFAIK, to properly display CJK characters in the console, there are "unicon" "zhcon" should be helpful...

Besides, I guess your PuTTY should support Chinese too...

----------

## vagus

Thanks for the reply.

My filenames and UTF coded, so I couldn't display them under zhcon...

I have fedora installed on my computer also. The thing that baffles me is that when I remotely access my files using PuTTY, I can read the chinese filenames under fedora. But I can't see chinese names for the same files under Gentoo, when I log in using PuTTY.

There must be something I have missed in my configuration somewhere...  :Sad: 

----------

## EricHsu

vagus, could you post the result of the following commands (Fedora's and gentoo's):

```

$ locale

$ locale -a

```

maybe we could get a clue from these...

----------

## blackwhite

 *vagus wrote:*   

> I have couple of files on my /home dir with chinese names. I can read the chinese filenames under gnome and gnome-terminal without any problem.
> 
> But when I go into system console or when I remotely login to my computer through SSH with PuTTY, all I get are ???????????????? for the filenames. This becomes somewhat an irritation because I can't identify my chinese filenames remotely...
> 
> I basically followed this guide: http://www.gentoo.org/doc/en/utf-8.xml
> ...

 

Actually, you should set putty support chinese. You check putty setting youself. It should work.

----------

## EricHsu

 *blackwhite wrote:*   

> 
> 
> Actually, you should set putty support chinese. You check putty setting youself. It should work.

 

 *vagus wrote:*   

> 
> 
> when I remotely access my files using PuTTY, I can read the chinese filenames under fedora
> 
> 

 

seems that vagus' PuTTY already supports chinese...

----------

## vagus

Hello!

Here is my `locale` under Gentoo:

```
LANG=

LC_CTYPE="POSIX"

LC_NUMERIC="POSIX"

LC_TIME="POSIX"

LC_COLLATE="POSIX"

LC_MONETARY="POSIX"

LC_MESSAGES="POSIX"

LC_PAPER="POSIX"

LC_NAME="POSIX"

LC_ADDRESS="POSIX"

LC_TELEPHONE="POSIX"

LC_MEASUREMENT="POSIX"

LC_IDENTIFICATION="POSIX"

LC_ALL=
```

`locale -a`

```
C

POSIX

en_HK

en_US

en_US.utf8

ja_JP

ja_JP.eucjp

ja_JP.utf8

zh_CN

zh_CN.gb2312

zh_CN.utf8

zh_HK.big5hkscs

zh_TW

zh_TW.big5

zh_TW.utf8
```

I am away from my computer now. I will post the fedora output once I go back.

----------

## vagus

Ok guys. I have finally solved my problem partially.

For some reason the gentoo UTF-8 guide tells us to put the $LANG and $LC_ALL environment variables in ~/.profile. It didn't work for me. Instead, I now define these variables in ~/.bashrc. Now remote login gives me the filenames in Chinese!  :Very Happy: 

My locale is now:

```
LANG=zh_CN.utf8

LC_CTYPE="en_US.utf8"

LC_NUMERIC="en_US.utf8"

LC_TIME="en_US.utf8"

LC_COLLATE="en_US.utf8"

LC_MONETARY="en_US.utf8"

LC_MESSAGES="en_US.utf8"

LC_PAPER="en_US.utf8"

LC_NAME="en_US.utf8"

LC_ADDRESS="en_US.utf8"

LC_TELEPHONE="en_US.utf8"

LC_MEASUREMENT="en_US.utf8"

LC_IDENTIFICATION="en_US.utf8"

LC_ALL=en_US.utf8

```

and my locale -a is now:

```
C

en_HK

en_US

en_US.utf8

ja_JP

ja_JP.eucjp

ja_JP.utf8

POSIX

zh_CN

zh_CN.gb2312

zh_CN.utf8

zh_HK.big5hkscs

zh_TW

zh_TW.big5

zh_TW.utf8
```

I still do not know a way to display chinese filenames under the system console. Don't think zhcon can do the job. But even so, I am happy enough with what it is now. Thank you guys!

----------

## blackwhite

 *Quote:*   

> For some reason the gentoo UTF-8 guide tells us to put the $LANG and $LC_ALL environment variables in ~/.profile.

 

I think ~/.profile should be .bash_profile  . Definately, the .bashrc is also a good place.

BTW, I have a system without chinese support for I set locales.build wrong. But I can though ssh log on this computer, and display chinese, It seems that it does not depend on whether the computer supports chinese, just depends on your local computer's language support.

----------

## EricHsu

 *vagus wrote:*   

> Ok guys. I have finally solved my problem partially.
> 
> For some reason the gentoo UTF-8 guide tells us to put the $LANG and $LC_ALL environment variables in ~/.profile. It didn't work for me. Instead, I now define these variables in ~/.bashrc. Now remote login gives me the filenames in Chinese! 
> 
> 

 

Another more "gentoo way" (IMO) to set the env vars in the /etc/env.d/99local, run env-update and re-login  :Smile: 

 *Quote:*   

> 
> 
> I still do not know a way to display chinese filenames under the system console. Don't think zhcon can do the job. But even so, I am happy enough with what it is now. Thank you guys!

 

Have you tried the unicon patch for kernel? It's a kernel level support for displaying chinese charaters, maybe it would be helpful for you  :Smile: 

----------

