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