sasori sasori - 4 months ago 17x
PHP Question

How to properly display Chinese characters in PHP?

I have these Chinese characters:


If I do

echo utf8_encode($chinesevar);

it displays


Or even if I just do a simple

echo $chinesevar

it still displays some weird characters...

So how am I going to display these Chinese characters without using the <meta> tag with the UTF-8 thingy .. or the ini_set UTF-8 thing or even the header() thing with UTF-8?



  1. save your source code in UTF-8
  2. output an HTTP header to specify to your browser that it should interpret the page using UTF-8:

    header('Content-Type: text/html; charset=utf-8');


utf8_encode is for converting Latin-1 encoded strings to UTF-8. You don't need it.

For more details, see Handling Unicode Front To Back In A Web App.