0
点赞
收藏
分享

微信扫一扫

linux本地化与国际化(宽字符、编码格式、字符集)(非正式参考)c++中的字符集与中文

秀儿2020 2023-06-04 阅读 19

  对于系统服务来说,国际化是必须解决的非功能特性之一。因此理解本地化是系统编程的重要一个环节。本节梳理一下本地化相关的设置和影响。

'2008-11-25 18:08:06+08' +08就代表该日期为北京时间的日期,UTC时间为10:08:06秒,前两者尤其容易出错,所以讨论日期必须确定日期交互用什么时区,跟确定用什么编码格式一样。如此下来,日期格式又变得很重要了,因为日期格式不正确的话,解析可能出错,也可能被忽略。所以LC_TIME得作用就体现出来了,因为经常要在日志中打印时间,为了易读性,经常date格式化,又不容易记住,又是个可以一劳永逸解决的环境设置。LC_MESSAGE的价值在于去国际化,例如设置信息提示总是英文格式,例如冒号。这样解析就一致了。

  本地化(locale)是指一系列环境变量,定义了应用程序和shell会话的语言、国家、字符编码。所有的系统库和本地化感知的应用都会使用这些环境变量,包括java、c、python、浏览器等,他们一般也提供了用于读取和修改环境变量的API。它会影响日期、时间的格式,数字格式化,货币格式化,默认编码格式等。

查看本地化设置和支持情况

  命令locale可以用来获取本地化相关的信息。

LOCALE(1)                                                                            Linux User Manual                                                                           LOCALE(1)

NAME
       locale - get locale-specific information

SYNOPSIS
       locale [option]
       locale [option] -a
       locale [option] -m
       locale [option] name...

DESCRIPTION
       The locale command displays information about the current locale, or all locales, on standard output.

       When  invoked without arguments, locale displays the current locale settings for each locale category (see locale(5)), based on the settings of the environment variables that con‐
       trol the locale (see locale(7)).  Values for variables set in the environment are printed without double quotes, implied values are printed with double quotes.

       If either the -a or the -m option (or one of their long-format equivalents) is specified, the behavior is as follows:

       -a, --all-locales
              Display a list of all available locales.  The -v option causes the LC_IDENTIFICATION metadata about each locale to be included in the output.

       -m, --charmaps
              Display the available charmaps (character set description files).  To display the current character set for the locale, use locale -c charmap.

       The locale command can also be provided with one or more arguments, which are the names of locale keywords (for example, date_fmt, ctype-class-names, yesexpr, or decimal_point) or
       locale categories (for example, LC_CTYPE or LC_TIME).  For each argument, the following is displayed:

       *  For a locale keyword, the value of that keyword to be displayed.

       *  For a locale category, the values of all keywords in that category are displayed.

       When arguments are supplied, the following options are meaningful:

       -c, --category-name
              For a category name argument, write the name of the locale category on a separate line preceding the list of keyword values for that category.

              For a keyword name argument, write the name of the locale category for this keyword on a separate line preceding the keyword value.

              This option improves readability when multiple name arguments are specified.  It can be combined with the -k option.

       -k, --keyword-name
              For each keyword whose value is being displayed, include also the name of that keyword, so that the output has the format:

                  keyword="value"

       The locale command also knows about the following options:

       -v, --verbose
              Display additional information for some command-line option and argument combinations.

       -?, --help
              Display a summary of command-line options and arguments and exit.

       --usage
              Display a short usage message and exit.

       -V, --version
              Display the program version and exit.

FILES
       /usr/lib/locale/locale-archive
              Usual default locale archive location.

       /usr/share/i18n/locales
              Usual default path for locale definition files.

CONFORMING TO
       POSIX.1-2001, POSIX.1-2008.

EXAMPLE
       $ locale       # 不带选项的locale可以查看当前的本地化设置
       LANG=en_US.UTF-8    最低优先级,LC_ALL、LC_*会覆盖相关设置。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=   # 覆盖所有LC_*环境变量的设置

       $ locale date_fmt
       %a %b %e %H:%M:%S %Z %Y

       $ locale -k date_fmt
       date_fmt="%a %b %e %H:%M:%S %Z %Y"

       $ locale -ck date_fmt
       LC_TIME
       date_fmt="%a %b %e %H:%M:%S %Z %Y"

       $ locale LC_TELEPHONE
       +%c (%a) %l
       (%a) %l
       11
       1
       UTF-8

       $ locale -k LC_TELEPHONE
       tel_int_fmt="+%c (%a) %l"
       tel_dom_fmt="(%a) %l"
       int_select="11"
       int_prefix="1"
       telephone-codeset="UTF-8"

       The  following  example  compiles  a custom locale from the ./wrk directory with the localedef(1) utility under the $HOME/.locale directory, then tests the result with the date(1)
       command, and then sets the environment variables LOCPATH and LANG in the shell profile file so that the custom locale will be used in the subsequent user sessions:

       $ mkdir -p $HOME/.locale
       $ I18NPATH=./wrk/ localedef -f UTF-8 -i fi_SE $HOME/.locale/fi_SE.UTF-8
       $ LOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF-8 date
       $ echo "export LOCPATH=\$HOME/.locale" >> $HOME/.bashrc
       $ echo "export LANG=fi_SE.UTF-8" >> $HOME/.bashrc

SEE ALSO
       localedef(1), charmap(5), locale(5), locale(7)

查看某个类别的详细信息

[root@lightdb1 ~]# locale -k LC_TIME
abday="Sun;Mon;Tue;Wed;Thu;Fri;Sat"
day="Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"
abmon="Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"
mon="January;February;March;April;May;June;July;August;September;October;November;December"
am_pm="AM;PM"
d_t_fmt="%a %d %b %Y %r %Z"
d_fmt="%m/%d/%Y"
t_fmt="%r"
t_fmt_ampm="%I:%M:%S %p"
era=
era_year=""
era_d_fmt=""
alt_digits=
era_d_t_fmt=""
era_t_fmt=""
time-era-num-entries=0
time-era-entries="S"
week-ndays=7
week-1stday=19971130
week-1stweek=7
first_weekday=1
first_workday=2
cal_direction=1
timezone=""
date_fmt="%a %b %e %H:%M:%S %Z %Y"
time-codeset="UTF-8"

[root@lightdb1 ~]# locale -k LC_CTYPE
ctype-class-names="upper";"lower";"alpha";"digit";"xdigit";"space";"print";"graph";"blank";"cntrl";"punct";"alnum";"combining";"combining_level3"
ctype-map-names="toupper";"tolower";"totitle"
ctype-width=16
ctype-mb-cur-max=6
charmap="UTF-8"
ctype-class-offset=72
ctype-map-offset=86
ctype-indigits_mb-len=1
ctype-indigits0_mb="0"
ctype-indigits1_mb="1"
ctype-indigits2_mb="2"
ctype-indigits3_mb="3"
ctype-indigits4_mb="4"
ctype-indigits5_mb="5"
ctype-indigits6_mb="6"
ctype-indigits7_mb="7"
ctype-indigits8_mb="8"
ctype-indigits9_mb="9"
ctype-indigits_wc-len=1
ctype-outdigit0_mb="0"
ctype-outdigit1_mb="1"
ctype-outdigit2_mb="2"
ctype-outdigit3_mb="3"
ctype-outdigit4_mb="4"
ctype-outdigit5_mb="5"
ctype-outdigit6_mb="6"
ctype-outdigit7_mb="7"
ctype-outdigit8_mb="8"
ctype-outdigit9_mb="9"
ctype-outdigit0_wc=48
ctype-outdigit1_wc=49
ctype-outdigit2_wc=50
ctype-outdigit3_wc=51
ctype-outdigit4_wc=52
ctype-outdigit5_wc=53
ctype-outdigit6_wc=54
ctype-outdigit7_wc=55
ctype-outdigit8_wc=56
ctype-outdigit9_wc=57
ctype-translit-tab-size=4554
ctype-translit-default-missing-len=1
ctype-translit-ignore-len=0
ctype-translit-ignore=""
map-to-nonascii=0

locale -a -v可以列出本系统支持的所有本地化

[root@lightdb1 ~]# locale -a | more
aa_DJ
aa_DJ.iso88591
aa_DJ.utf8
aa_ER
aa_ER@saaho
aa_ER.utf8
aa_ER.utf8@saaho
aa_ET
aa_ET.utf8
af_ZA
af_ZA.iso88591
af_ZA.utf8
am_ET
am_ET.utf8
an_ES
an_ES.iso885915
an_ES.utf8


[root@lightdb1 ~]# locale -a -v | more
locale: aa_DJ           archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | Afar language locale for Djibouti (CaduLaaqo Dialects).
   source | Ge'ez Frontier Foundation
  address | 7802 Solomon Seal Dr., Springfield, VA 22152, USA
    email | locales@geez.org
 language | aa
territory | DJ
 revision | 0.20
     date | 2003-07-05
  codeset | ISO-8859-1

locale: aa_DJ.iso88591  archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | Afar language locale for Djibouti (CaduLaaqo Dialects).
   source | Ge'ez Frontier Foundation
  address | 7802 Solomon Seal Dr., Springfield, VA 22152, USA
    email | locales@geez.org
 language | aa
territory | DJ
 revision | 0.20
     date | 2003-07-05
  codeset | ISO-8859-1

locale: aa_DJ.utf8      archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | Afar language locale for Djibouti (CaduLaaqo Dialects).
   source | Ge'ez Frontier Foundation
  address | 7802 Solomon Seal Dr., Springfield, VA 22152, USA
    email | locales@geez.org
 language | aa
territory | DJ
 revision | 0.20
     date | 2003-07-05
  codeset | UTF-8

locale: aa_ER           archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | Afar language locale for Eritrea (CaduLaaqo Dialects).
   source | Ge'ez Frontier Foundation
  address | 7802 Solomon Seal Dr., Springfield, VA 22152, USA
    email | locales@geez.org
 language | aa
territory | ER
 revision | 0.20
     date | 2003-07-05
  codeset | UTF-8

locale: aa_ER@saaho     archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | Afar language locale for Eritrea (Saaho Dialect).
   source | Ge'ez Frontier Foundation
  address | 7802 Solomon Seal Dr., Springfield, VA 22152, USA
    email | locales@geez.org
 language | aa
territory | ER
 revision | 0.20
     date | 2003-07-05
  codeset | UTF-8

locale: aa_ER.utf8      archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | Afar language locale for Eritrea (CaduLaaqo Dialects).
   source | Ge'ez Frontier Foundation
  address | 7802 Solomon Seal Dr., Springfield, VA 22152, USA
    email | locales@geez.org
 language | aa
territory | ER
 revision | 0.20
     date | 2003-07-05
  codeset | UTF-8

locale: aa_ER.utf8@saah archive: /usr/lib/locale/locale-archive
-------------------------------------------------------------------------------
    title | Afar language locale for Eritrea (Saaho Dialect).
   source | Ge'ez Frontier Foundation
  address | 7802 Solomon Seal Dr., Springfield, VA 22152, USA
    email | locales@geez.org
 language | aa
territory | ER
 revision | 0.20
     date | 2003-07-05
  codeset | UTF-8

常用字符集和排序规则

   https://www.postgresql.org/docs/13/charset.html

  在时区上面,环境变量TZ可以用来设置对应的时区(并不是所有的Linux默认都导出了TZ环境变量)。命令tzselect可以用来查看安装的所有时区。

  关于时区,首先来看GMT和UTC的区别。

  Greenwich Mean Time (GMT) is often interchanged or confused with Coordinated Universal Time (UTC). But GMT is a time zone and UTC is a time standard.

[root@lightdb1 ~]# tzselect 
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
 1) Africa
 2) Americas
 3) Antarctica
 4) Arctic Ocean
 5) Asia
 6) Atlantic Ocean
 7) Australia
 8) Europe
 9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format.
#? 5
Please select a country.
 1) Afghanistan          18) Israel            35) Palestine
 2) Armenia          19) Japan            36) Philippines
 3) Azerbaijan          20) Jordan            37) Qatar
 4) Bahrain          21) Kazakhstan        38) Russia
 5) Bangladesh          22) Korea (North)        39) Saudi Arabia
 6) Bhutan          23) Korea (South)        40) Singapore
 7) Brunei          24) Kuwait            41) Sri Lanka
 8) Cambodia          25) Kyrgyzstan        42) Syria
 9) China          26) Laos            43) Taiwan
10) Cyprus          27) Lebanon            44) Tajikistan
11) East Timor          28) Macau            45) Thailand
12) Georgia          29) Malaysia            46) Turkmenistan
13) Hong Kong          30) Mongolia            47) United Arab Emirates
14) India          31) Myanmar (Burma)        48) Uzbekistan
15) Indonesia          32) Nepal            49) Vietnam
16) Iran          33) Oman            50) Yemen
17) Iraq          34) Pakistan
#? 9
Please select one of the following time zone regions.
1) Beijing Time
2) Xinjiang Time
#? 1

The following information has been given:

    China
    Beijing Time

Therefore TZ='Asia/Shanghai' will be used.
Local time is now:    Sat Nov  6 18:17:11 CST 2021.
Universal Time is now:    Sat Nov  6 10:17:11 UTC 2021.
Is the above information OK?
1) Yes
2) No
#? 1          

You can make this change permanent for yourself by appending the line
    TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Shanghai

  tzselect并不修改系统本身的时区,只是进行对应的调整,要安装后调整时区,可以使用linuxredhat-config-date命令。

  因为redhat 7+包含了systemd子系统,其中包含timedatectl命令,可以用来查看当前时区设置。如下:

[root@lightdb1 ~]# timedatectl
      Local time: Sat 2021-11-06 19:33:45 CST
  Universal time: Sat 2021-11-06 11:33:45 UTC
        RTC time: Sat 2021-11-06 11:33:45
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: no
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

  timedatectl还可以用来修改时区。timedatectl set-timezone Europe/Amsterdam

  date则会考虑TZ环境变量。

[root@lightdb1 ~]# export TZ=Asia/Shanghai
[root@lightdb1 ~]# timedatectl
Warning: Ignoring the TZ variable. Reading the system's time zone setting only.

      Local time: Sat 2021-11-06 11:39:25 UTC
  Universal time: Sat 2021-11-06 11:39:25 UTC
        RTC time: Sat 2021-11-06 11:39:25
       Time zone: UTC (UTC, +0000)
     NTP enabled: no
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
[root@lightdb1 ~]# date
Sat Nov  6 19:39:27 CST 2021
[root@lightdb1 ~]# 
[root@lightdb1 ~]# export TZ=UTC
[root@lightdb1 ~]# date
Sat Nov  6 11:39:35 UTC 2021

[root@lightdb1 ~]# export TZ=Asia/Shanghai
[root@lightdb1 ~]# date
2021年 11月 06日 星期六 19:46:10 CST        # China Standard Time,不显示 
[root@lightdb1 ~]# locale -k date_fmt
date_fmt="%Y年 %m月 %d日 %A %H:%M:%S %Z"
[root@lightdb1 ~]# export LANG=en_US.UTF-8
[root@lightdb1 ~]# locale -k date_fmt
date_fmt="%a %b %e %H:%M:%S %Z %Y"
[root@lightdb1 ~]# date
Sat Nov  6 11:45:19 UTC 2021

  修改时间格式需要修改/usr/share/i18n/locales下对应区域的配置。一般用户不太允许,可以使用alias实现统一。

[root@lightdb1 locales]# alias date="date '+%Y%m%d %H%M%S'"
[root@lightdb1 locales]# date
20211106 202315
[root@lightdb1 locales]#

  可以写到.bash_profile文件中。

修改本地化设置

  localectl可以用来修改系统的本地化设置。

LOCALECTL(1)                                                                             localectl                                                                            LOCALECTL(1)

NAME
       localectl - Control the system locale and keyboard layout settings

SYNOPSIS
       localectl [OPTIONS...] {COMMAND}

DESCRIPTION
       localectl may be used to query and change the system locale and keyboard layout settings.

       The system locale controls the language settings of system services and of the UI before the user logs in, such as the display manager, as well as the default for users after
       login.

       The keyboard settings control the keyboard layout used on the text console and of the graphical UI before the user logs in, such as the display manager, as well as the default for
       users after login.

       Use systemd-firstboot(1) to initialize the system locale for mounted (but not booted) system images.

OPTIONS
       The following options are understood:

       --no-ask-password
           Do not query the user for authentication for privileged operations.

       --no-convert
           If set-keymap or set-x11-keymap is invoked and this option is passed, then the keymap will not be converted from the console to X11, or X11 to console, respectively.

       -H, --host=
           Execute the operation remotely. Specify a hostname, or a username and hostname separated by "@", to connect to. The hostname may optionally be suffixed by a container name,
           separated by ":", which connects directly to a specific container on the specified host. This will use SSH to talk to the remote machine manager instance. Container names may
           be enumerated with machinectl -H HOST.

       -h, --help
           Print a short help text and exit.

       --version
           Print a short version string and exit.

       --no-pager
           Do not pipe output into a pager.

       The following commands are understood:

       status
           Show current settings of the system locale and keyboard mapping.

       set-locale LOCALE...
           Set the system locale. This takes one or more assignments such as "LANG=de_DE.utf8", "LC_MESSAGES=en_GB.utf8", and so on. See locale(7) for details on the available settings
           and their meanings. Use list-locales for a list of available locales (see below).

       list-locales
           List available locales useful for configuration with set-locale.

       set-keymap MAP [TOGGLEMAP]
           Set the system keyboard mapping for the console and X11. This takes a mapping name (such as "de" or "us"), and possibly a second one to define a toggle keyboard mapping.
           Unless --no-convert is passed, the selected setting is also applied as the default system keyboard mapping of X11, after converting it to the closest matching X11 keyboard
           mapping. Use list-keymaps for a list of available keyboard mappings (see below).

       list-keymaps
           List available keyboard mappings for the console, useful for configuration with set-keymap.

       set-x11-keymap LAYOUT [MODEL [VARIANT [OPTIONS]]]
           Set the system default keyboard mapping for X11 and the virtual console. This takes a keyboard mapping name (such as "de" or "us"), and possibly a model, variant, and options,
           see kbd(4) for details. Unless --no-convert is passed, the selected setting is also applied as the system console keyboard mapping, after converting it to the closest matching
           console keyboard mapping.

       list-x11-keymap-models, list-x11-keymap-layouts, list-x11-keymap-variants [LAYOUT], list-x11-keymap-options
           List available X11 keymap models, layouts, variants and options, useful for configuration with set-keymap. The command list-x11-keymap-variants optionally takes a layout
           parameter to limit the output to the variants suitable for the specific layout.

EXIT STATUS
       On success, 0 is returned, a non-zero failure code otherwise.

ENVIRONMENT
       $SYSTEMD_PAGER
           Pager to use when --no-pager is not given; overrides $PAGER. Setting this to an empty string or the value "cat" is equivalent to passing --no-pager.

       $SYSTEMD_LESS
           Override the default options passed to less ("FRSXMK").

SEE ALSO
       systemd(1), locale(7), locale.conf(5), vconsole.conf(5), loadkeys(1), kbd(4), The XKB Configuration Guide[1], systemctl(1), systemd-localed.service(8), systemd-firstboot(1)

NOTES
        1. The XKB Configuration Guide
           http://www.x.org/releases/current/doc/xorg-docs/input/XKB-Config.html

本地化标准配置存储在/usr/share/i18n/locales/目录下。

字符集描述文件存储在/usr/share/i18n/charmaps/目录下,iconv命令使用的from和to参数就是对应这里的字符集描述文件。

[root@lightdb1 locales]# pwd
/usr/share/i18n/locales
[root@lightdb1 locales]# ll | grep -i utf
[root@lightdb1 locales]# ll | grep -i en
-rw-r--r--. 1 root root    2227 4月  28 2021 en_AG
-rw-r--r--. 1 root root    5237 4月  28 2021 en_AU
-rw-r--r--. 1 root root    2574 4月  28 2021 en_BW
-rw-r--r--. 1 root root    5755 4月  28 2021 en_CA
-rw-r--r--. 1 root root    4852 4月  28 2021 en_DK
-rw-r--r--. 1 root root    5343 4月  28 2021 en_GB
-rw-r--r--. 1 root root    6896 4月  28 2021 en_HK
-rw-r--r--. 1 root root    4942 4月  28 2021 en_IE
-rw-r--r--. 1 root root    1475 4月  28 2021 en_IE@euro
-rw-r--r--. 1 root root    6305 4月  28 2021 en_IN
-rw-r--r--. 1 root root    8770 4月  28 2021 en_NG
-rw-r--r--. 1 root root    5203 4月  28 2021 en_NZ
-rw-r--r--. 1 root root    6846 4月  28 2021 en_PH
-rw-r--r--. 1 root root    6598 4月  28 2021 en_SG
-rw-r--r--. 1 root root    5560 4月  28 2021 en_US

[root@lightdb1 locales]# ll | grep -i zh
-rw-r--r--. 1 root root    5562 4月  28 2021 zh_CN
-rw-r--r--. 1 root root    5853 4月  28 2021 zh_HK
-rw-r--r--. 1 root root    6104 4月  28 2021 zh_SG
-rw-r--r--. 1 root root    5626 4月  28 2021 zh_TW


[root@lightdb1 i18n]# ll
总用量 28
drwxr-xr-x. 2 root root  8192 5月  25 14:10 charmaps
drwxr-xr-x. 2 root root 12288 5月  25 14:10 locales

[root@lightdb1 i18n]# cd charmaps/
[root@lightdb1 charmaps]# ll | more
总用量 3292
-rw-r--r--. 1 root root   4779 4月  28 2021 ANSI_X3.110-1983.gz
-rw-r--r--. 1 root root   1626 4月  28 2021 ANSI_X3.4-1968.gz
-rw-r--r--. 1 root root   2179 4月  28 2021 ARMSCII-8.gz
-rw-r--r--. 1 root root   1588 4月  28 2021 ASMO_449.gz
-rw-r--r--. 1 root root  77396 4月  28 2021 BIG5.gz
-rw-r--r--. 1 root root 110198 4月  28 2021 BIG5-HKSCS.gz

-rw-r--r--. 1 root root   2066 4月  28 2021 EBCDIC-AT-DE-A.gz
-rw-r--r--. 1 root root   2130 4月  28 2021 EBCDIC-AT-DE.gz
[root@lightdb1 charmaps]# ll | grep GBK
-rw-r--r--. 1 root root 119109 4月  28 2021 GBK.gz
[root@lightdb1 charmaps]# ll | grep GB
-rw-r--r--. 1 root root 645856 4月  28 2021 GB18030.gz
-rw-r--r--. 1 root root   1592 4月  28 2021 GB_1988-80.gz
-rw-r--r--. 1 root root  44796 4月  28 2021 GB2312.gz
-rw-r--r--. 1 root root 119109 4月  28 2021 GBK.gz
[root@lightdb1 charmaps]# ll | grep UTF
-rw-r--r--. 1 root root 333313 4月  28 2021 UTF-8.gz

c++中的字符集与中文

https://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html   linux所有的环境变量

https://www.ibm.com/docs/en/integration-bus/9.0.0?topic=locales-changing-your-locale-linux-unix-systems  LC_*含义

https://www.tecmint.com/set-system-locales-in-linux/

https://www.cyberciti.biz/faq/linux-unix-set-tz-environment-variable/

https://linux-audit.com/configure-the-time-zone-tz-on-linux-systems

https://en.cppreference.com/w/c/locale/LC_categories

chs locale?https://www.codenong.com/cs109068713/

最主要的两个字符集转换库icu和iconv https://www.zhihu.com/question/21962474

举报

相关推荐

0 条评论