locale::facet::_S_create_c_locale name not valid解決方案,isnotavaliddate

來源:互聯網
上載者:User

locale::facet::_S_create_c_locale name not valid解決方案,isnotavaliddate

在很多的shell指令碼中,我們經常會看見某一句命令的前面有一句“LC_ALL=C”SAR_CMD="LC_ALL=C sar -u -b 1 5 | grep -i average "這到底是什麼意思?LC_ALL=C 是為了去除所有本地化的設定,讓命令能正確執行。---------------------------------轉帖:http://www.linuxsky.org/doc/newbie/200707/84.html在Linux中通過locale來設定程式啟動並執行不同語言環境,locale由ANSI C提供支援。locale的命名規則為<語言>_<地區>.<字元集編碼>,如zh_CN.UTF-8,zh代表中文,CN代表大陸地區,UTF-8表示字元集。在locale環境中,有一組變數,代表國際化環境中的不同設定:1.    LC_COLLATE定義該環境的排序和比較規則2.    LC_CTYPE用於字元分類和字串處理,控制所有字元的處理方式,包括字元編碼,字元是單位元組還是多位元組,如何列印等。是最重要的一個環境變數。3.    LC_MONETARY貨幣格式4.    LC_NUMERIC非貨幣的數字顯示格式5.    LC_TIME時間和日期格式6.    LC_MESSAGES提示資訊的語言。另外還有一個LANGUAGE參數,它與LC_MESSAGES相似,但如果該參數一旦設定,則LC_MESSAGES參數就會失效。LANGUAGE參數可同時設定多種語言資訊,如LANGUANE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"。7.    LANGLC_*的預設值,是最低層級的設定,如果LC_*沒有設定,則使用該值。類似於 LC_ALL。8.    LC_ALL它是一個宏,如果該值設定了,則該值會覆蓋所有LC_*的設定值。注意,LANG的值不受該宏影響。C"是系統預設的locale,"POSIX"是"C"的別名。所以當我們新安裝完一個系統時,預設的locale就是C或POSIX。"POSIX" :Specifies the minimal environment for C-language translation called the POSIX locale. If setlocale() is not invoked, the POSIX locale is the default"C"  Equivalent to "POSIX".-----------------------------------How to view the current locale setting?# localeHow to change the locale setting?* Via the CDE login locale* As a user-specific locale* As a system default localeTo change the current locale setting, first confirm that the desired locale isinstalled on the system with:# locale -adeen_AUen_CAen_UKCIf the desired locale is not in the list, you will need to install theappropriate packages for that locale. See the Note below for more informationabout locale packages.How to change the locale via the CDE login locale?On the CDE login banner:Choose options - languagesUnder languages - choose the new localeThe CDE banner will re-cycle and then you can login to the selected locale.NOTE: If a user has a different default locale set in their environment, thethat locale setting will override the selected CDE login locale.How to set a user-specific locale?Note:For sh, ksh:LANG=C; export LANGLC_ALL=C; export LC_ALLFor csh:setenv LANG Csetenv LC_ALL CNote: To set a default locale for a user's environment, set the LANG or LC_*variables in a user's shell intialization file such as $HOME/.profile or$HOME/.cshrcHow to change the locale by setting the system default locale?LANG=CLC_ALL=CExample from the /etc/default/init file:Lines of this file should be of the form VAR=value, where VAR is one ofTZ, LANG, or any of the LC_* environment variables.LANG=CLC_ALL=CNote: The system must be rebooted after making changes to the/etc/default/init file in order for the changes to take effect.How to verify the locale setting?After setting or changing the locale, verify that the locale is set correctly:Check if the locale is set correctly by running the locale command without anyoptions:# localeLANG=CLC_CTYPE= "C"LC_NUMERIC= "C"LC_TIME= "C"LC_COLLATE= "C"LC_MONETARY= "C"LC_MESSAGES= "C"LC_ALL=C

相關文章

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.