开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜