PHP read blob garbled blob stored in normal text, there is a Chinese

Source: Internet
Author: User
PHP MySQL Database garbled

MySQL is stored in ordinary text, the database is not garbled, on the page when the Chinese language garbled, how to solve this problem? Please help us.


Reply to discussion (solution)

The database is not garbled? What tool did you use to view the

The database is not garbled? What tool did you use to view the


with MySQL Front
The type of the garbled field is Longblob
Show after query
[1] = = Array (7) {
["question_index"] = + string (1) "2"
["Question_content_text"] + = string (21) "Will The birds fly?" "
["question_type"] = + string (9) "Question"
["answer"] = + string (+) "????????????"
["user_answer"] = + string (1) "2"
["question_score"] = + string (2) "10"
["user_score"] = + string (1) "0"
}

From the length 16, your answer field is not utf-8 encoded, is it?

Echo Base64_encode ($ar [1][' answer ']); Post the results

From the length 16, your answer field is not utf-8 encoded, is it?

Echo Base64_encode ($ar [1][' answer ']); Post the results


Echo Base64_encode ($ar [1][' answer ']), then appears:
v8ne3lvho6y/yctcsru74q==

$s = base64_decode (' v8ne3lvho6y/yctcsru74q== '); Var_dump ($s);
String (16) "may or may not be"
It's GBK encoded.

You need to execute the set names UTF8 directive before querying
or transcoding before output
  • 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.