首页 > 代码库 > LINUX专题之操作系统字符集
LINUX专题之操作系统字符集
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。
深蓝的blog: http://blog.csdn.net/huangyanlong/article/details/40213133
以实验范例的形式演示LINUX操作系统字符集知识,用实践加深理解。
【实验演示】
例1:字符集相关查看
[root@xckydb sysconfig]# cat /etc/issue
--查看系统版本
CentOS release 5.6 (Final)
Kernel \r on an \m
[root@xckydb sysconfig]# locale -a
--查看本地的字符集
aa_DJaa_DJ.iso88591aa_DJ.utf8aa_ERaa_ER@saahoaa_ER.utf8aa_ER.utf8@saahoaa_ETaa_ET.utf8af_ZAaf_ZA.iso88591af_ZA.utf8am_ETam_ET.utf8an_ESan_ES.iso885915an_ES.utf8ar_AEar_AE.iso88596ar_AE.utf8ar_BHar_BH.iso88596ar_BH.utf8ar_DZar_DZ.iso88596ar_DZ.utf8ar_EGar_EG.iso88596ar_EG.utf8ar_INar_IN.utf8ar_IQar_IQ.iso88596ar_IQ.utf8ar_JOar_JO.iso88596ar_JO.utf8ar_KWar_KW.iso88596ar_KW.utf8ar_LBar_LB.iso88596ar_LB.utf8ar_LYar_LY.iso88596ar_LY.utf8ar_MAar_MA.iso88596ar_MA.utf8ar_OMar_OM.iso88596ar_OM.utf8ar_QAar_QA.iso88596ar_QA.utf8ar_SAar_SA.iso88596ar_SA.utf8ar_SDar_SD.iso88596ar_SD.utf8ar_SYar_SY.iso88596ar_SY.utf8ar_TNar_TN.iso88596ar_TN.utf8ar_YEar_YE.iso88596ar_YE.utf8as_IN.utf8az_AZ.utf8be_BYbe_BY.cp1251be_BY@latinbe_BY.utf8be_BY.utf8@latinbg_BGbg_BG.cp1251bg_BG.utf8bn_BDbn_BD.utf8bn_INbn_IN.utf8bokmalbokmbr_FRbr_FR@eurobr_FR.iso88591br_FR.iso885915@eurobr_FR.utf8bs_BAbs_BA.iso88592bs_BA.utf8byn_ERbyn_ER.utf8Cca_ADca_AD.iso885915ca_AD.utf8ca_ESca_ES@euroca_ES.iso88591ca_ES.iso885915@euroca_ES.utf8ca_FRca_FR.iso885915ca_FR.utf8ca_ITca_IT.iso885915ca_IT.utf8catalancroatiancsb_PLcsb_PL.utf8cs_CZcs_CZ.iso88592cs_CZ.utf8cy_GBcy_GB.iso885914cy_GB.utf8czechda_DKda_DK.iso88591da_DK.iso885915da_DK.utf8danishdanskde_ATde_AT@eurode_AT.iso88591de_AT.iso885915@eurode_AT.utf8de_BEde_BE@eurode_BE.iso88591de_BE.iso885915@eurode_BE.utf8de_CHde_CH.iso88591de_CH.utf8de_DEde_DE@eurode_DE.iso88591de_DE.iso885915@eurode_DE.utf8de_LUde_LU@eurode_LU.iso88591de_LU.iso885915@eurode_LU.utf8deutschdutchdz_BTdz_BT.utf8eestiel_CYel_CY.iso88597el_CY.utf8el_GRel_GR.iso88597el_GR.utf8en_AUen_AU.iso88591en_AU.utf8en_BWen_BW.iso88591en_BW.utf8en_CAen_CA.iso88591en_CA.utf8en_DKen_DK.iso88591en_DK.utf8en_GBen_GB.iso88591en_GB.iso885915en_GB.utf8en_HKen_HK.iso88591en_HK.utf8en_IEen_IE@euroen_IE.iso88591en_IE.iso885915@euroen_IE.utf8en_INen_IN.utf8en_NZen_NZ.iso88591en_NZ.utf8en_PHen_PH.iso88591en_PH.utf8en_SGen_SG.iso88591en_SG.utf8en_USen_US.iso88591en_US.iso885915en_US.utf8en_ZAen_ZA.iso88591en_ZA.utf8en_ZWen_ZW.iso88591en_ZW.utf8es_ARes_AR.iso88591es_AR.utf8es_BOes_BO.iso88591es_BO.utf8es_CLes_CL.iso88591es_CL.utf8es_COes_CO.iso88591es_CO.utf8es_CRes_CR.iso88591es_CR.utf8es_DOes_DO.iso88591es_DO.utf8es_ECes_EC.iso88591es_EC.utf8es_ESes_ES@euroes_ES.iso88591es_ES.iso885915@euroes_ES.utf8es_GTes_GT.iso88591es_GT.utf8es_HNes_HN.iso88591es_HN.utf8es_MXes_MX.iso88591es_MX.utf8es_NIes_NI.iso88591es_NI.utf8es_PAes_PA.iso88591es_PA.utf8es_PEes_PE.iso88591es_PE.utf8es_PRes_PR.iso88591es_PR.utf8es_PYes_PY.iso88591es_PY.utf8es_SVes_SV.iso88591es_SV.utf8estonianes_USes_US.iso88591es_US.utf8es_UYes_UY.iso88591es_UY.utf8es_VEes_VE.iso88591es_VE.utf8et_EEet_EE.iso88591et_EE.iso885915et_EE.utf8eu_ESeu_ES@euroeu_ES.iso88591eu_ES.iso885915@euroeu_ES.utf8fa_IRfa_IR.utf8fi_FIfi_FI@eurofi_FI.iso88591fi_FI.iso885915@eurofi_FI.utf8finnishfo_FOfo_FO.iso88591fo_FO.utf8fran fr_BEfr_BE@eurofr_BE.iso88591fr_BE.iso885915@eurofr_BE.utf8fr_CAfr_CA.iso88591fr_CA.utf8fr_CHfr_CH.iso88591fr_CH.utf8frenchfr_FRfr_FR@eurofr_FR.iso88591fr_FR.iso885915@eurofr_FR.utf8fr_LUfr_LU@eurofr_LU.iso88591fr_LU.iso885915@eurofr_LU.utf8fy_NLfy_NL.utf8ga_IEga_IE@euroga_IE.iso88591ga_IE.iso885915@euroga_IE.utf8galegogaliciangd_GBgd_GB.iso885915gd_GB.utf8germangez_ERgez_ER@abegedegez_ER.utf8gez_ER.utf8@abegedegez_ETgez_ET@abegedegez_ET.utf8gez_ET.utf8@abegedegl_ESgl_ES@eurogl_ES.iso88591gl_ES.iso885915@eurogl_ES.utf8greekgu_INgu_IN.utf8gv_GBgv_GB.iso88591gv_GB.utf8hebrewhe_ILhe_IL.iso88598he_IL.utf8hi_INhi_IN.utf8hr_HRhr_HR.iso88592hr_HR.utf8hrvatskihsb_DEhsb_DE.iso88592hsb_DE.utf8hu_HUhu_HU.iso88592hu_HU.utf8hungarianhy_AMhy_AM.armscii8hy_AM.utf8icelandicid_IDid_ID.iso88591id_ID.utf8is_ISis_IS.iso88591is_IS.utf8italianit_CHit_CH.iso88591it_CH.utf8it_ITit_IT@euroit_IT.iso88591it_IT.iso885915@euroit_IT.utf8iw_ILiw_IL.iso88598iw_IL.utf8ja_JPja_JP.eucjpja_JP.ujisja_JP.utf8japanesejapanese.eucka_GEka_GE.georgianpska_GE.utf8kk_KZkk_KZ.pt154kk_KZ.utf8kl_GLkl_GL.iso88591kl_GL.utf8km_KHkm_KH.utf8kn_INkn_IN.utf8ko_KRko_KR.euckrko_KR.utf8koreankorean.eucku_TRku_TR.iso88599ku_TR.utf8kw_GBkw_GB.iso88591kw_GB.utf8ky_KGky_KG.utf8lg_UGlg_UG.iso885910lg_UG.utf8lithuanianlo_LAlo_LA.utf8lt_LTlt_LT.iso885913lt_LT.utf8lv_LVlv_LV.iso885913lv_LV.utf8mai_INmai_IN.utf8mg_MGmg_MG.iso885915mg_MG.utf8mi_NZmi_NZ.iso885913mi_NZ.utf8mk_MKmk_MK.iso88595mk_MK.utf8ml_INml_IN.utf8mn_MNmn_MN.utf8mr_INmr_IN.utf8ms_MYms_MY.iso88591ms_MY.utf8mt_MTmt_MT.iso88593mt_MT.utf8nb_NOnb_NO.iso88591nb_NO.utf8ne_NPne_NP.utf8nl_BEnl_BE@euronl_BE.iso88591nl_BE.iso885915@euronl_BE.utf8nl_NLnl_NL@euronl_NL.iso88591nl_NL.iso885915@euronl_NL.utf8nn_NOnn_NO.iso88591nn_NO.utf8no_NOno_NO.iso88591no_NO.utf8norwegiannr_ZAnr_ZA.utf8nso_ZAnso_ZA.utf8nynorskoc_FRoc_FR.iso88591oc_FR.utf8om_ETom_ET.utf8om_KEom_KE.iso88591om_KE.utf8or_INor_IN.utf8pa_INpa_IN.utf8pa_PKpa_PK.utf8pl_PLpl_PL.iso88592pl_PL.utf8polishportuguesePOSIXpt_BRpt_BR.iso88591pt_BR.utf8pt_PTpt_PT@europt_PT.iso88591pt_PT.iso885915@europt_PT.utf8romanianro_ROro_RO.iso88592ro_RO.utf8ru_RUru_RU.iso88595ru_RU.koi8rru_RU.utf8russianru_UAru_UA.koi8uru_UA.utf8rw_RWrw_RW.utf8se_NOse_NO.utf8sid_ETsid_ET.utf8si_LKsi_LK.utf8sk_SKsk_SK.iso88592sk_SK.utf8slovakslovenesloveniansl_SIsl_SI.iso88592sl_SI.utf8so_DJso_DJ.iso88591so_DJ.utf8so_ETso_ET.utf8so_KEso_KE.iso88591so_KE.utf8so_SOso_SO.iso88591so_SO.utf8spanishsq_ALsq_AL.iso88591sq_AL.utf8sr_CSsr_CS.iso88595sr_CS.utf8sr_MEsr_ME.utf8sr_RSsr_RS@latinsr_RS.utf8sr_RS.utf8@latinss_ZAss_ZA.utf8st_ZAst_ZA.iso88591st_ZA.utf8sv_FIsv_FI@eurosv_FI.iso88591sv_FI.iso885915@eurosv_FI.utf8sv_SEsv_SE.iso88591sv_SE.iso885915sv_SE.utf8swedishta_INta_IN.utf8te_INte_IN.utf8tg_TJtg_TJ.koi8ttg_TJ.utf8thaith_THth_TH.tis620th_TH.utf8ti_ERti_ER.utf8ti_ETti_ET.utf8tig_ERtig_ER.utf8tl_PHtl_PH.iso88591tl_PH.utf8tn_ZAtn_ZA.utf8tr_CYtr_CY.iso88599tr_CY.utf8tr_TRtr_TR.iso88599tr_TR.utf8ts_ZAts_ZA.utf8tt_RU.utf8turkishuk_UAuk_UA.koi8uuk_UA.utf8ur_PKur_PK.utf8uz_UZuz_UZ@cyrillicuz_UZ.iso88591uz_UZ.utf8@cyrillicve_ZAve_ZA.utf8vi_VNvi_VN.tcvnvi_VN.utf8wa_BEwa_BE@eurowa_BE.iso88591wa_BE.iso885915@eurowa_BE.utf8xh_ZAxh_ZA.iso88591xh_ZA.utf8yi_USyi_US.cp1255yi_US.utf8zh_CNzh_CN.gb18030zh_CN.gb2312zh_CN.gbkzh_CN.utf8zh_HKzh_HK.big5hkscszh_HK.utf8zh_SGzh_SG.gb2312zh_SG.gbkzh_SG.utf8zh_TWzh_TW.big5zh_TW.euctwzh_TW.utf8zu_ZAzu_ZA.iso88591zu_ZA.utf8
************************************************************************************************
[root@xckydb sysconfig]# locale -m
--查看所有支持的字符集
ANSI_X3.110-1983ANSI_X3.4-1968ARMSCII-8ASMO_449BIG5BIG5-HKSCSBS_4730BS_VIEWDATACP10007CP1125CP1250CP1251CP1252CP1253CP1254CP1255CP1256CP1257CP1258CP737CP775CP949CSA_Z243.4-1985-1CSA_Z243.4-1985-2CSA_Z243.4-1985-GRCSN_369103CWIDEC-MCSDIN_66003DS_2089EBCDIC-AT-DEEBCDIC-AT-DE-AEBCDIC-CA-FREBCDIC-DK-NOEBCDIC-DK-NO-AEBCDIC-ESEBCDIC-ES-AEBCDIC-ES-SEBCDIC-FI-SEEBCDIC-FI-SE-AEBCDIC-FREBCDIC-IS-FRISSEBCDIC-ITEBCDIC-PTEBCDIC-UKEBCDIC-USECMA-CYRILLICESES2EUC-JISX0213EUC-JPEUC-JP-MSEUC-KREUC-TWGB18030GB2312GBKGB_1988-80GEORGIAN-ACADEMYGEORGIAN-PSGOST_19768-74GREEK-CCITTGREEK7GREEK7-OLDHP-ROMAN8IBM037IBM038IBM1004IBM1026IBM1047IBM1124IBM1129IBM1132IBM1133IBM1160IBM1161IBM1162IBM1163IBM1164IBM256IBM273IBM274IBM275IBM277IBM278IBM280IBM281IBM284IBM285IBM290IBM297IBM420IBM423IBM424IBM437IBM500IBM850IBM851IBM852IBM855IBM856IBM857IBM860IBM861IBM862IBM863IBM864IBM865IBM866IBM866NAVIBM868IBM869IBM870IBM871IBM874IBM875IBM880IBM891IBM903IBM904IBM905IBM918IBM922IEC_P27-1INISINIS-8INIS-CYRILLICINVARIANTISIRI-3342ISO-8859-1ISO-8859-10ISO-8859-11ISO-8859-13ISO-8859-14ISO-8859-15ISO-8859-16ISO-8859-2ISO-8859-3ISO-8859-4ISO-8859-5ISO-8859-6ISO-8859-7ISO-8859-8ISO-8859-9ISO-IR-197ISO-IR-209ISO-IR-90ISO_10367-BOXISO_10646ISO_11548-1ISO_2033-1983ISO_5427ISO_5427-EXTISO_5428ISO_646.BASICISO_646.IRVISO_6937ISO_6937-2-25ISO_6937-2-ADDISO_8859-1,GLISO_8859-SUPPITJIS_C6220-1969-JPJIS_C6220-1969-ROJIS_C6229-1984-AJIS_C6229-1984-BJIS_C6229-1984-B-ADDJIS_C6229-1984-HANDJIS_C6229-1984-HAND-ADDJIS_C6229-1984-KANAJIS_X0201JOHABJUS_I.B1.002JUS_I.B1.003-MACJUS_I.B1.003-SERBKOI-8KOI8-RKOI8-TKOI8-UKSC5636LATIN-GREEKLATIN-GREEK-1MAC-CYRILLICMAC-ISMAC-SAMIMAC-UKMACINTOSHMIKMSZ_7795.3NATS-DANONATS-DANO-ADDNATS-SEFINATS-SEFI-ADDNC_NC00-10NEXTSTEPNF_Z_62-010NF_Z_62-010_(1973)NF_Z_62-010_1973NS_4551-1NS_4551-2PTPT154PT2RK1048SAMISAMI-WS2SEN_850200_BSEN_850200_CSHIFT_JISSHIFT_JISX0213T.101-G2T.61-7BITT.61-8BITTCVN5712-1TIS-620TSCIIUTF-8VIDEOTEX-SUPPLVISCIIWIN-SAMI-2WINDOWS-31J
[root@xckydb sysconfig]# echo $LANG
--查看默认设置的字符集
en_US.UTF-8
[root@xckydb /]# cd /etc/sysconfig
--到系统配置目录下查找字符集配置文件
[root@xckydb sysconfig]# ls
atd crond ip6tables-config lm_sensors ntpd selinux udev-stw
auditd desktop ipmi mkinitrd pand sendmail vncservers
authconfig dund iptables-config modules pm-action smartmontools wpa_supplicant
autofs firstboot irda named prelink squid xinetd
bluetooth grub irqbalance netconsole raid-check syslog
cbq hidd kdump network rawdevices sysstat
clock httpd kernel networking readonly-root sysstat.ioconf
conman hwconf keyboard network-scripts rhn system-config-securitylevel
console i18n krb524 nfs samba system-config-users
cpuspeed init kudzu nspluginwrapper saslauthd tux
[root@xckydb sysconfig]# cat i18n
--查看系统使用语言的文件,内容如下
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
--说明
--LANG变量是language的简称,即系统的菜单、程序的工具栏语言、输入法默认语言等
--SYSFONT是system font的简称,决定系统默认用哪一种字体。
例2:临时修改字符集
[root@xckydb sysconfig]# echo $LANG
--查看当前系统字符集
en_US.UTF-8
[root@xckydb sysconfig]# export LANG="zh_CN.UTF-8"
--临时性修改系统字符集
[root@xckydb sysconfig]# echo $LANG
--显示修改后系统字符集
zh_CN.UTF-8
例3:修改字符集
[root@xckydb sysconfig]# vi /etc/sysconfig/i18n
LANG="zh_CN.UTF-8"
SYSFONT="latarcyrheb-sun16"
~
--修改保存后退出,完成系统字符集的修改
[root@xckydb sysconfig]# echo $LANG
zh_CN.UTF-8
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。
深蓝的blog: http://blog.csdn.net/huangyanlong/article/details/40213133
LINUX专题之操作系统字符集