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.