How does JQUERY solve the problem of loading Chinese garbled characters? -Php Tutorial

Source: Internet
Author: User
How does JQUERY solve the problem of loading Chinese garbled characters? How does JQUERY solve the problem of loading Chinese garbled characters?

The two files are both gbk2312 a.html load. how can I get B .html Chinese garbled characters?

I cannot find Baidu


Reply to discussion (solution)

1. UTF-8
2.

1. UTF-8
2.



I used two pages to save the GB2312 Code with NOTEPAD ++ and added

Still not good

It is not allowed to directly return B .html.
Must be transcoded for B .html or use php to issue a character set declaration
For example

   

When parameters are passed, the parameters must undergo UTF-8 to gbk transcoding.

It is not allowed to directly return B .html.
Must be transcoded for B .html or use php to issue a character set declaration
For example

     

When parameters are passed, the parameters must undergo UTF-8 to gbk transcoding.



What if the website generates HTML in the future?

If you use ajax, it is better to use UTF-8.

It is not allowed to directly return B .html.
Must be transcoded for B .html or use php to issue a character set declaration
For example

      

When parameters are passed, the parameters must undergo UTF-8 to gbk transcoding.




What if the website generates HTML in the future?

Is there any perfect solution for the moderator? Can you give me a thought?

If you use ajax, it is better to use UTF-8.



I have a database on GB2313 and I want to share the database, so this is troublesome.



If you use ajax, it is better to use UTF-8.




// The key value of the data sent by post or get to this. keys = Array (); this. values = Array (); this. keyCount =-1; this. sendlang = 'gb2312'; // request header type this. rtype = 'text'; // initialize xmlhttp // IE6, IE5 if (window. activeXObject) {try {DedeXHTTP = new ActiveXObject ("Msxml2.XMLHTTP");} catch (e) {} if (DedeXHTTP = null) try {DedeXHTTP = new ActiveXObject ("Microsoft. XMLHTTP ");} catch (e) {}} else {DedeXHTTP = new XMLHttpRequest ();}// Add a POST or GET key-value pair this. addKeyN = function (skey, svalue) {if (this. sendlang = 'utf-8') this. addKeyUtf8 (skey, svalue); else this. addKey (skey, svalue) ;}; this. addKey = function (skey, svalue) {this. keyCount ++; this. keys [this. keyCount] = skey; svalue = svalue + ''; if (svalue! = '') Svalue = svalue. replace (/\ +/g, '$ # $'); this. values [this. keyCount] = escape (svalue) ;}; // add a POST or GET key-value pair to this. addKeyUtf8 = function (skey, svalue) {this. keyCount ++; this. keys [this. keyCount] = skey; svalue = svalue + ''; if (svalue! = '') Svalue = svalue. replace (/\ +/g, '$ # $'); this. values [this. keyCount] = encodeURI (svalue );};


I saw this dream.

Open the html to be loaded by load in Notepad. when saving it as an encoding, select UTF-8 and save it. it is available for test.

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.