Chinese garbled characters in windows txt files opened in Gentoo

Source: Internet
Author: User

Chinese garbled characters in windows txt files opened in Gentoo
Differences in language encoding between Linux and Windows: In a Linux operating system, we sometimes open txt files in windows and find that Chinese characters are garbled in the txt files normally displayed in windows. This problem occurs because the Chinese character encoding methods (compression mode) of the two operating systems are different. In windows, the Chinese character encoding is generally gbk, and in linux, utf8, this leads to the normal display of txt files in windows and the garbled state in linux. Set the system code to locale. gen file #/etc/locale. gen: list all of the locales you want to have on your system # The format of each line: # <locale> <charmap >## Where <locale> is a locale located in/usr/share/i18n/locales/and # where <charmap> is a charmap located in/usr /share/i18n/charmaps /. # All blank lines and lines starting with # are ignored. # For the default list of supported combinations, see the file :# /Usr/share/i18n/SUPPORTED # Whenever glibc is emerged, the locales listed here will be automatically # rebuilt for you. after updating this file, you can simply run 'locale-gen' # yourself instead of re-emerging glibc. en_US.UTF-8 UTF-8zh_CN.UTF-8 UTF-8 view system language encoding type/usr/share/i18n/locales/directory contains the supported encoding language type gentoo ~ # Ls/usr/share/i18n/locales/en_US en_GB en_HK zh_CN zh_TW zh_HKja_JP de_DE ...... gentoo ~ # View character encoding compression/usr/share/i18n/charmaps/directory contains the character encoding supported by the system ls/usr/share/i18n/charmaps/ANSI_X3.110-1983.gz IBM1026.gz ISO-8859-16.gzANSI_X3.4-1968.gz IBM1047.gz unzip IBM1124.gz ISO-8859-1.gzASMO_449.gz IBM1129.gz ISO-8859-2.gzGB18030.gz ISIRI-3342.gz SAMI.gzGB_1988-80.gz ISO_10367-BOX.gz ISO_10646.gz SEN_850200_ B .gzGBK.gz SAMI-WS2.gzGB2312.gz ISO_6937.gz ISO_11548-1.gz ...... the solution uses the iconvcommand to upload and convert files. If the file name is hello.txt, enter the following command on the terminal: iconv-f gbk-t utf8 hello.txt> hello.utf8.txt

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.