MySQL x87xe7xa7x91xe7x82 the data when the Chinese change

Source: Internet
Author: User
When MySQL inserts data, does Chinese change \x87\xe7\xa7\x91\xe7\x82 this?
The following test parameters are defined on the server-side PHP file, and the client does not transmit;
$SQLSTR data read by ADODB MSSQL database, read the Chinese transcoding: Iconv ("GBK", "UTF-8", $str)

If you run the server-side PHP file directly, run MySQL inert without problems

However, if the client post to PHP, run MySQL error:

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 = ' 2001 ', Reid = ' 1002 ', topid = ' 1002 ', Sortrank = ' + ', TypeName = ' gynecological inflammation ', Typedir = ' {Cmsp ath}/a ' no problem.

Run directly on Mysql-front:
INSERT into dede_arctype SET id = ' 2001 ', Reid = ' 1002 ', topid = ' 1002 ', Sortrank = ' + ', TypeName = ' gynecological inflammation ', Typedir = ' {Cmspath }/a ' is no problem.

Why is this???
MySQL;

Share to:


------Solution--------------------
However, if the client post to PHP, run MySQL error:

Incorrect string value: ' \x87\xe7\xa7\x91\xe7\x82 ... ' for column ' TypeName ' at row 1


Convert the data you post to the code.

$typename = Iconv ("UTF-8", "UTF-8", $typename);


You try to switch from Utf-8 to Utf-8.
------Solution--------------------
$db->execute ("SET NAMES UTF-8");???
This is where the problem lies!
$db->execute ("SET NAMES UTF8");
MySQL indicates that the name of the utf-8 character set is UTF8 that's not utf-8.
This particular situation stems from the initial programmer's hand error, but can no longer be corrected.
------Solution--------------------
Implementation of the form data passed to the server by the client: UrlEncode () encoded URL string
  • 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.