How to enable garbled CSV files in Excel

Source: Internet
Author: User
Tags coding standards
Use C # Program Use streamwriter to export a string, generate a TXT text file, and use NotePad to open it normally. Change it to the CSV format. use Excel to open garbled characters, and the column cannot be correctly identified. And then open it in Notepad. After changing the encoding from UTF-8 to ANSI, You can correctly identify the column and no garbled characters. [Fault description] exported data files stored in CSV format from the web page. It is okay to use NotePad to open the text, and garbled characters are displayed in Excel. [Fault Cause Analysis] This situation is generally caused by the exported file encoding. In the Simplified Chinese environment, CSV files opened in Excel are ANSI encoded by default. If the CSV files are encoded in UTF-8 or unicode format, file garbled characters may occur. [Solution] (1) set the office language environment (take office 2003 as an example): Start Menu-Microsoft Office tool-Microsoft Office 2003 language settings, set the default language of Microsoft Office applications to "Chinese (simplified)", which is also the default setting of Office 2003. (2) use NotePad to open the CSV file, save the file as, and select ANSI: (3) After the file is saved, it will not be garbled when you open the file in Excel: [encoding method description] (1) Different ANSI coding standards have been developed for different countries and regions, resulting in respective coding standards such as gb2312, big5, and JIS. These two bytes are used to represent the extended Chinese character encoding methods of a single character. They are called ANSI encoding. In a simplified Chinese system, ANSI encoding represents gb2312 encoding. In a Japanese operating system, ANSI encoding represents JIS encoding. Different ANSI encodings are incompatible. When information is exchanged internationally, texts in two languages cannot be stored in the same ANSI encoded text. Of course, For ANSI encoding, 0x00 ~ The characters between 0x7f are still 1 byte representing 1 character. This is the biggest and most obvious difference between asni encoding and Unicode encoding. For example, no garbled characters are found in English letters and numbers. (2) Unicode (unified code, universal code, Single Code) is a character encoding used on a computer. It sets a unified and unique binary code for each character in each language to meet the requirements of cross-language and cross-platform text conversion and processing. R & D started in December 1990 and officially announced in December 1994. With the enhancement of computer capabilities, Unicode has been popularized in more than a decade since its launch. Unicode is a character encoding scheme developed by international organizations to accommodate all texts and symbols in the world. Unicode maps these characters with numbers 0-0x10ffff. It can contain up to 1114112 characters, or contain 1114112 characters. The bitwise is the number that can be allocated to characters. UTF-8, UTF-16, and UTF-32 are encoding schemes that convert numbers to program data. (3) UTF-8 encoding UTF-8 is a unicode Variable Length character encoding, also known as Wanguo code, was created by Ken Thompson in 1992. Now it has been standardized as RFC 3629. The UTF-8 encodes Unicode characters in 1 to 6 bytes. You can use the web page to display Chinese Simplified, traditional Chinese, and other languages (such as Japanese and Korean) on the same page ).

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.