With or without religion, you would have good people doing good things and evil people doing evil things. But for good people to do evil things, that takes religion.
- Steven Weinberg

PHP MySQL & UTF-8 Encoding

Trying to display chinese text in a PHP script from a MySQL DB, proved to be more tricky than i thought, using phpMyAdmin i was able to insert an edit chinese text in a db which has a ‘utf8_general_ci’ charset, but when i tried to show that text in a php page the only thing i’ve got was a long string of question marks.
Searching for a solution on the internet, i found this solution in a comment in php.net

mysql_query("SET CHARACTER SET 'utf8'", $conn);

Placing this just before the query did the trick!

Leave a Reply