How to properly display Chinese characters in PHP?

前端 未结 5 2009
清酒与你
清酒与你 2020-12-04 01:39

I have these Chinese characters:

汉字/漢字\'\'test

If I do

echo utf8_encode($chinesevar);

it displays

<
5条回答
  •  借酒劲吻你
    2020-12-04 01:57

    Look that your file is in UTF8 without BOM and that your webserver deliver your site in UTF-8

    HTML:

    
    

    in PHP:

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

    And if you work with a database look that your database is in UTF-8 if you read the text from your database.

提交回复
热议问题