Solution to Asp.net's problem of reading MySQL database garbled characters

Source: Internet
Author: User
Add gb2312 and GBK in the following ing table, so there will be no garbled characters. The source code is provided below
Written by a netizen Program Changed

Private   Static   Void Loadcharsetmap ()
{
Mapping =   New Hashtable ();

Mapping. Add ( " Big5 " , " Big5 " ); // Traditional Chinese
Mapping. Add ( " Sjis " , " Sjis " ); // Shift-JIS
Mapping. Add ( " Gb2312 " , " Gb2312 " );
Mapping. Add ( " Latin1 " , " Latin1 " );
Mapping. Add ( " Latin2 " , " Latin2 " );
Mapping. Add ( " Latin3 " , " Latin3 " );
Mapping. Add ( " Latin4 " , " Latin4 " );
Mapping. Add ( " Latin5 " , " Latin5 " );
Mapping. Add ( " Greek " , " Greek " );
Mapping. Add ( " Hebrew " , " Hebrew " );
Mapping. Add ( " Utf8 " , " UTF-8 " );
Mapping. Add ( " Ucs2 " , " UTF-16BE " );
Mapping. Add ( " Cp1251 " , 1251 );
Mapping. Add ( " Tis620 " , 874 );
Mapping. Add ( " Binary " , " Latin1 " );

// Relatively sure about
/**/ /* Mapping. Add ("default", 0 );
Mapping. Add ("cp1251", 1251); // Russian
Mapping. Add ("win1251", 1251 );
Mapping. Add ("GBK", 936); // Simplified Chinese
Mapping. Add ("cp866", 866 );
Mapping. Add ("euc_kr", 949 );

// Maybe, maybe not
Mapping. Add ("win1250", 1250); // central eurpoe
Mapping. Add ("win1251ukr", 1251 );
Mapping. Add ("latinsponde", 1252); // Latin1 German
Mapping. Add ("german1", 1252); // German
Mapping. Add ("Danish", 1252); // Danish
Mapping. Add ("dos", 437); // DoS
Mapping. Add ("pclatin2", 852 );
Mapping. Add ("win1250ch", 1250 );
Mapping. Add ("cp1257", 1257 );
Mapping. Add ("usa7", 646 );
Mapping. Add ("Czech", 912 );
Mapping. Add ("Hungarian", 912 );
Mapping. Add ("Croat", 912 ); */

/**/ /* ("Gb2312", "euc_cn ");
("Ujis", "euc_jp ");
("Latvian", "iso8859_13 ");
("Latvian1", "iso8859_13 ");
("Estonia", "iso8859_13 ");
("Koi8_ru", "koi8_r ");
("Tis620", "tis620 ");
("Macroman", "macroman ");
("Macce", "maccentraleurope ");
*/

}

Source code: http://files.cnblogs.com/goody9807/mysql_src.rar

http://files.cnblogs.com/goody9807/mysql_src.rar

Related Article

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.