4. Change the database encoding, PHP code, js code, HTML coding for all GBK, still not solve the problem, still can get data from the database, but Chinese string in PHP error, the new data in PHP page is correct (echo verified), but the background is still gibberish,
5 to join in PHP page. The following code:
Mysqli_query (" set character set GBK ' '");//read library
Mysqli_query (" set names' GBK '");//write library
Still an error!!!!!! , modified to
Mysql_query (" set character set GBK ' '");//read library
Mysql_query (" set names' GBK '");//write library
Or wrong!!!!!!!!!!!!!!!!
Think of ajax set up to send data in the format as utf8, although feel transmission between Taiwan before and after there is no problem, or trying to modified, xmlHttp. SetRequestHeader (' the content-type ', 'application/x - WWW - form - urlencoded; GBK charset=');
No eggs, still wrong!!!!!!!!!!!!!!!!!!!
Is really no way to ah!!!!!
CodePudding user response:
Years of bloody lesson is all to utf8 and never to GB, as you know, the ajax use utf8 alone can bring a lot of trouble brought before and after the GB transcoding,1, first the database, data table all set utf8;
2, the PHP backend archived into no BOM utf8 text file itself, and in the beginning of writing a @ header (" content-type: text/HTML. charset=utf-8");
Have both back-end it should be OK, don't use a mysql_query,
If you must show with GB code, front-end HTML then only transcoding only here
CodePudding user response:
UTF8 also has an error, with a system of SugarCRM, + PHP, and Mysql character UTF8, large probability complains when inserted data