Solution to garbled Chinese characters after the Godaddy Database

Source: Internet
Author: User
Tags mssql server mysql tutorial mysql backup

How to solve Chinese garbled characters after the Godaddy database tutorial


1. Open the backed up SQL text in notepad to ensure that the data in the file is properly displayed.
2. view the storage format of this text, generally ANSI (Chinese generally gbk or gb2312) and UTF-8.
3. If the file storage format is ANSI, add the following statements at the top of the SQL file:
/*! 40101 set names gbk */;
If the file storage format is UTF-8, add the following statement at the top of the SQL file:
/*! 40101 set names utf8 */;
4. Save and use the modified SQL file to restore the mysql tutorial database.
 

My MYSQL backup files are too large, and over 300 M, UltraEdit, and EditPlus are difficult to handle. The results are handled by using WinHex to directly modify the SQL file header.

 

Finally, I started to write the code. I wrote a test code on the page. The method is the same as that used for SQL Server database or access database. There is no difference.


Mssql server accessk garbled characters

Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Web;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Data. OleDb;
Using System. Data;
Using MySql. Data. MySqlClient;

Namespace s
{
Public partial class _ Default: System. Web. UI. Page
{
/// <Summary>
/// Wukong note: In the following code, I marked the server address and database name as Chinese. You can modify the code as needed.
/// Wukong's blog www.7es.cn
/// </Summary>
/// <Param name = "sender"> </param>
/// <Param name = "e"> </param>
Protected void Page_Load (object sender, EventArgs e)
{
// Wukong's blog www.zhutiai.com
MySqlConnection conn = new MySqlConnection ("Server = Server address; Port = 3306; Database = Database name; Uid = username; Pwd = 'Password ';");
Conn. Open ();
MySqlCommand cmd = new MySqlCommand ("select * from table name", conn );
MySqlDataReader dr = cmd. ExecuteReader ();
If (dr. Read ())
{
Response. Write (dr ["field name"]. ToString ());
}
Dr. Close ();
Dr. Dispose ();
Cmd. Dispose ();
Response. Write ("<br> end ");

}
}
}

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.