When mysql inserts data, what is the Chinese character \ x87 \ xE7 \ xA7 \ x91 \ xE7 \ x82? The following test & nbsp; parameters are defined in the PHP file on the server, and are not transmitted on the client; $ sqlstr & nbsp; data is read by the adodb mssql database, and Chinese transcoding is read: iconv ("when mysql inserts data, is the Chinese character changed to \ x87 \ xE7 \ xA7 \ x91 \ xE7 \ x82?
The following test parameters are defined in the PHP file on the server and are not transmitted on the client;
$ Sqlstr data read by adodb mssql database, read Chinese Transcoding: iconv ("GBK", "UTF-8", $ str)
If you directly run the php file on the server, running mysql inert directly will not cause problems.
However, if a post is sent from the client to php, an error is returned when mysql is run:
Incorrect string value: '\ x87 \ xE7 \ xA7 \ x91 \ xE7 \ x82...' for column 'typename' at row 1
If echo $ sqlstr
Output: insert into dede_arctype SET id = '000000', reid = '000000', topid = '000000', sortrank = '50', typename = 'gynecological inflammatory ', typedir = '{cmspath}/A' no problem
Run directly on mysql-front:
Insert into dede_arctype SET id = '000000', reid = '000000', topid = '000000', sortrank = '50', typename = 'gynecological inflammatory ', no problem with typedir = '{cmspath}/'
Why ???
Mysql; share:
------ Solution --------------------
However, if a post is sent from the client to php, an error is returned when mysql is run:
Incorrect string value: '\ x87 \ xE7 \ xA7 \ x91 \ xE7 \ x82...' for column 'typename' at row 1
Convert the data you post to the encoding.
$typename = iconv("UTF-8", "UTF-8", $typename);
Try converting from UTF-8 to UTF-8
------ Solution --------------------
$ Db-> Execute ("set names UTF-8 ");???
This is the problem!
$ Db-> Execute ("set names UTF8 ");
Mysql indicates that the UTF-8 character set name is utf8, not UTF-8.
This special case is due to a programmer's mistake, but it cannot be corrected.
------ Solution --------------------
Implement urlencode ()-encoded URL string for form data transmitted from the client to the server