Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fail to `export LC_ALL=zh_CN.gbk' or export LC_ALL=zh_CN.gb18030.

260 views
Skip to first unread message

Hongyi Zhao

unread,
Jun 6, 2020, 9:00:16 AM6/6/20
to
Hi,

I'm using Ubuntu 20.04, and the current locale is as follows:

$ locale
LANG=en_US.UTF-8
LANGUAGE=
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=en_US.UTF-8

When I try to change the locale temporarily for dealing on some files whose names are encoded with GB2312/GBK/GB18030 encodings, I meet the following warnings:

$ export LC_ALL=zh_CN.gbk
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gbk): No such file or directory
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gbk)
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gbk)
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gbk)
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gbk)
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gbk)
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gbk)

$ export LC_ALL=zh_CN.gb18030
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gb18030): No such file or directory
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gb18030)
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gb18030)
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gb18030)
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gb18030)
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gb18030)
bash: warning: setlocale: LC_ALL: cannot change locale (zh_CN.gb18030)


Any hints for this problem?

Regards.

Chris Elvidge

unread,
Jun 6, 2020, 9:25:46 AM6/6/20
to
Have you generated these locales?
See locale-gen and update-locale
Or
add new locale(s) to /var/lib/locales/supported.d/local
and then dpkg-reconfigure locales



--

Chris Elvidge, England

Hongyi Zhao

unread,
Jun 6, 2020, 10:42:35 AM6/6/20
to
在 2020年6月6日星期六 UTC+8下午9:25:46,Chris Elvidge写道:
I finally found the following workaround for solving this problem:

$ sudo apt-get install language-pack-zh-hans language-pack-zh-hant

# It seems the above command will invoke the locale-gen for generating the needed locales, so I'm not sure whether the following two commands are demanding. Anyway, they are harmless:
$ sudo locale-gen zh_CN.GB18030
$ sudo locale-gen zh_CN.GBK

HY

>
>
>
> --
>
> Chris Elvidge, England

0 new messages