Simple solution to the problem of Ubuntu modification locale

Source: Internet
Author: User
Tags locale psql

Psql when prompted:

Perl:warning:Setting locale failed.
Perl:warning:Please Check that your locale settings:
    LANGUAGE = "En_hk:en",
    lc_all = (unset),
    lc_paper = "en _cn. UTF-8 ",
    lc_address =" ZH_CN. UTF-8 ",
    lc_monetary =" ZH_CN. UTF-8 ",
    lc_numeric =" ZH_CN. UTF-8 ",
    lc_telephone =" ZH_CN. UTF-8 ",
    lc_identification =" ZH_CN. UTF-8 ",
    lc_measurement =" ZH_CN. UTF-8 ",
    lc_time =" ZH_CN. UTF-8 ",
    lc_name =" ZH_CN. UTF-8 ",
    LANG =" EN_HK. UTF-8 "
    are supported and installed on your system.
Perl:warning:Falling back to a fallback locale ("EN_HK. UTF-8 ").

SELECT * from Test;

Inside Store man's field unexpectedly is 
<E6><9D><8E> ...
.

View default characters for client_encodeing

Show client_encoding;
 Client_encoding 
-----------------
 sql_ascii

#设置为UTF8

\encoding UTF8

It's not over, it's embarrassing.

The internet search is actually a problem with the local character set:

$locale

locale:cannot set Lc_ctype to default locale:no such file or directory
Locale:cannot set Lc_messages to Default locale:no such file or directory
locale:cannot set Lc_all to default locale:no such file or directory
Lang=zh_cn. UTF8
language=en_hk:en
lc_ctype= "ZH_CN. UTF8 "
lc_numeric=zh_cn. UTF-8
LC_TIME=ZH_CN. UTF-8
lc_collate= "ZH_CN. UTF8 "
lc_monetary=zh_cn. UTF-8
lc_messages= "ZH_CN. UTF8 "
lc_paper=zh_cn. UTF-8
LC_NAME=ZH_CN. UTF-8
LC_ADDRESS=ZH_CN. UTF-8
LC_TELEPHONE=ZH_CN. UTF-8
LC_MEASUREMENT=ZH_CN. UTF-8
LC_IDENTIFICATION=ZH_CN. UTF-8
lc_all=

To achieve the purpose of the normal display of Chinese characters in your application, the following three variables should be as follows:

Lang=zh_cn. UTF-8   
language=zh_cn:zh:en_us:en   
lc_all=lc_all=zh_cn. UTF-8

Support Chinese Simplified execution:
sudo apt-get-y install Language-pack-zh-hans

Support Chinese Traditional execution:
sudo apt-get-y install language-pack-zh-hant

Then go to psql. Linked database execution SQL can be directly displayed in Chinese, and there is no following
The warning:

$psql _db
psql (9.6.4)
Type ' help ' for help.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.