I've got a problem with the display of Chinese characters in the
Terminal and was hoping that someone here would have an idea of how to
resolve it. Specifically the problem is with file names that use
Chinese characters.
Saving a document with a Chinese name is no problem using the ITABC
input method. I can also view that file name in the finder with no
trouble.
However if I view the file name in the terminal the chinese file name
今天.txt displays as ??????.txt.
My guess here is that the two unicode characters are being read as 6
ascii or some other such short encoded letters.
This doesn't make sense to me as everything I have read suggests that
OS X (Tiger) is unicode ready.
If anyone is able to help I would be most grateful.
Ian Stanton
I am not sure at all, but please try
ls -v
instead of simple 'ls' -- I suppose that your Terminal encoding is
set to UTF-8:
File > Show Info > (Terminal Inspector) > Display > Character Set
Encoding > Unicode (UTF-8)
Good luck!
Best regards,
Nobumi Iyanaga
Tokyo,
Japan
Onto a different but similar problem. If I try to type in Chinese at
the terminal the Chinese characters are replaced by numbers like this
\344\273\212\345\244251, that is what I got when typing 今天。I
believe it is called "escaping non ascii characters." It isn't too
much of a problem. It is just inelegant.
The consequence is basically such that a directory can be created at
the command line and given a Chinese name, but as soon as the correct
characters from the name are selected from the input method the
characters are replaced by 'escaped characters'. That is whilst
inputting them. As soon as the commnad is completed that new directory
can be viewed with its name in the correct format and if I wish to then
navigate to that directory I can simply type cd and its name and the
command will work.
I've done some searches and the solution seems to be to change the
shell from bash to zsh. I think Tiger comes with zsh so I don't think
it will be a problem. It also seems that there may be some general
advantages to using zsh over bash.
I was wondering if anyone has tried to use the terminal to type Chinese
characters and has a different solution to this.
Nobumi Iyanaga wrote:
> Hello Ian,
>
> ls -v
...if I view the file name in the terminal the chinese file name
今天.txt displays as ??????.txt.