Trying to display Vietnamese characters with php
When I try to display Vietnamese characters with the following code:
<?php
$str = "Nghệ thuật cắm hoa vải";
//echo utf8开发者_运维百科_encode(html_entity_decode(($str)));
echo html_entity_decode($str);
//echo $str;
?>
I get Ngh�? thu�?t c??m hoa va?i as a result. Tried several option but couldn't make it. Any ideas?
Is the PHP script encoded in UTF-8? If it is, send a header indicating so:
header("Content-type: text/html; charset=utf-8");
Alternatively, do:
echo mb_convert_encoding($string, "HTML-ENTITIES", "UTF-8");
Works fine for me: http://codepad.org/uTmORRmz
Does your browser support Unicode?
精彩评论