Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to launch a binary in bash and the output of the binary consist of some Chinese character. so my question is how to let bash display Chinese character correctly. by the way, I use Centos.

share|improve this question
    
You may need to know what character set and encoding (Big5, UTF8, ...) the binary uses. It should pick this up from the CentOS environment variables (e.g. LANG) but may have it's own settings. You also need a font that contains the character set (Simplified, Traditional, ...) and configure the display (terminal app, console or X-Windows) to use it. –  RedGrittyBrick Jun 14 '12 at 13:56
add comment

1 Answer

You need UTF-8 encoding to have all Chinese characters displayed correctly.

To see your current locale just type locale and you will get a similar output like this:

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

If you see a LANG=en_US.UTF-8 or similar including the "UTF-8" substring, you will have all Chinese characters shown correctly.

Also, keep in mind that your terminal needs UTF-8 support too. This could give further information.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.