开发者

Trying to display Vietnamese characters with php

开发者 https://www.devze.com 2023-01-06 15:35 出处:网络
When I try to display Vietnamese characters with the following code: <?php $str = \"Nghệ thuật cắm hoa vải\";

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

精彩评论

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