About transcoding related issues

Source: Internet
Author: User
About transcoding Issues
Import 503-9256962-4382268 Failure-1
You have a error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near ' 054-246-0787 ', ' JPS0001 ', ' 0243-BK ', ' iphone 4 with arm strap (black) ', ' 1 ', ' Buzzard?? ' at line 1

I have done transcoding also reported above error, my transcoding function:
$recipient _name=mb_convert_encoding (Addslashes ($u [+]), ' UTF-8 ', ' Utf-8,sjis-win,eucjp-win ');



Echo Base64_encode ($u [16]) Result: MGIRG4XC

I output transcoding after the result is right: "Buzzard Nest GUI", but do not know to write to the database will be error, I found that only contains "GUI" will be written to the database failed.

Is there any way to solve this problem??

Share to:


------Solution--------------------
$s = base64_decode (' mgirg4xc ');
Echo ' character set ', mb_detect_encoding ($s, ' utf-8,sjis-win,eucjp-win '), '
';
Echo ' 16 inside code ', Bin2Hex ($s), '
';
Echo ' Utf-8 ', $t = mb_convert_encoding ($s, ' utf-8 ', ' Utf-8,sjis-win,eucjp-win '), '
';
Echo ' 16 binary inside code ', Bin2Hex ($t);

Character Set Jis-win
16 in-code 986891838c 5cThis 5c is \ 's 16 binary inside code
Utf-8 Buzzard Nest GUI
16 Binary inside Code E9B7B2E5B7A3E59CAD

So you need
$recipient _name=mb_convert_encoding ($u [+], ' UTF-8 ', ' Utf-8,sjis-win,eucjp-win ');
Instead of
$recipient _name=mb_convert_encoding (Addslashes ($u [+]), ' UTF-8 ', ' Utf-8,sjis-win,eucjp-win ');
That can't be escaped with addslashes.

Escape ' requires Str_replace ("'", "\ '", $s)
  • 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.