Php: chinese support settings锛寊h_CN.UTF-8

Created on 5 Jan 2017  路  5Comments  路  Source: docker-library/php

I used the 5.6php image from Debian OS
https://github.com/docker-library/docs/tree/master/php

i have set chinese support, but still Messy Display when i edit a file with vim,
also i have set my xshell terminal...i followed these two guides
http://www.cnblogs.com/sslizy/p/4057397.html
http://blog.wifizoo.net/?post=82

cat /etc/debian_version

8.6

php -v

PHP Warning: Module 'redis' already loaded in Unknown on line 0
PHP 5.6.27 (cli) (built: Oct 21 2016 23:13:17)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

apt-get install locales

dpkp-reconfigure locales

locale -a

C
C.UTF-8
POSIX
en_US.utf8
zh_CN
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8

Most helpful comment

Because base image default locale is C, which does not support UTF-8 characters.

If you want to display Chinese characters, just set an environment variable LC_ALL to C.UTF-8. E.g:

docker run --rm -e LC_ALL=C.UTF-8 <your_image_name>

Thus you can see any UTF-8 characters.

All 5 comments

@yosifkit

Did you set LANG in your image after generating the correct locales? (ie, -e LANG=zh_CN.utf8 or ENV LANG zh_CN.utf8)

Because base image default locale is C, which does not support UTF-8 characters.

If you want to display Chinese characters, just set an environment variable LC_ALL to C.UTF-8. E.g:

docker run --rm -e LC_ALL=C.UTF-8 <your_image_name>

Thus you can see any UTF-8 characters.

@abcfy2 Amazing, it worked, thanx a lot.

@abcfy2 You are my hero!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yosifkit picture yosifkit  路  3Comments

2Kable picture 2Kable  路  3Comments

solocommand picture solocommand  路  3Comments

nojimage picture nojimage  路  3Comments

ktrzos picture ktrzos  路  3Comments