Display UTF8 encoding records such as Chinese or Asian languages from MySQL database with PHP

Posted by Shek on June 23, 2008 under PHP | Be the First to Comment | Total View: 1,001 views

Editor’s note: If you are a programmer who involves with a database with UTF8 language encoding records such as Chinese or other Asian languages. You might counter some cases when you try to display the records, the UTF8 language characters might appear to be meaningless symbols. I have found a way to solve this issue.

Include the codes below in the beginning of the PHP file which the UTF8 encoding language records will be displayed from that file:

1
2
3
4
<?php 
header("Content-Type: text/html; charset=utf-8");
mysql_query("SET NAMES UTF8");
?>

Similar Posts:

VN:F [1.9.13_1145]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.13_1145]
Rating: +1 (from 1 vote)
Display UTF8 encoding records such as Chinese or Asian languages from MySQL database with PHP, 10.0 out of 10 based on 1 rating

Add A Comment

*