To do a website containing Vietnamese, users said that in the preservation of articles containing Vietnamese, msyql garbled, look at the following solution
I test myself, many characters become '? '。 The database connection is already using the UTF8 character set: The code is as follows: Define ("Mysql_encode", "UTF8"); mysql_query (' SET NAMES '. Mysql_encode, $conn) or Die (' character set error '. Mysql_error ()); For half an hour, I didn't get it. Insert the data are still garbled, suddenly think, is not the field can not save these Vietnamese text. I look at the database character set, the default is GBK, this to Chinese is no problem, a touch of Vietnamese text, it is garbled. As a result, I modified the character set of the field that might be used in Vietnamese to UTF8, and proofread it to: Utf8_unicode_ci. (Here must specifically modify a field, modify the entire table's character set, does not work, the field or retain the original character set) problem solved. My database is: Php_college_web table: city_article fields in Vietnamese: Title,content executes the following SQL: The code is as follows: ALTER TABLE city_article Change Ti Tle title VARCHAR (MB) CHARACTER SET UTF8 COLLATE utf8_unicode_ci ALTER TABLE city_article Change content content text C Haracter SET UTF8 COLLATE utf8_unicode_ci