Reputation: 57
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?
Upvotes: 1
Views: 6195
Reputation: 541
Try testing:
$str = mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1');
$str = mb_convert_encoding($str, 'ISO-8859-1', 'UTF-8');
Upvotes: 0
Reputation: 29267
Works fine for me: http://codepad.org/uTmORRmz
Does your browser support Unicode?
Upvotes: 0
Reputation: 97815
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");
Upvotes: 3