Charset=utf8 not working in my PHP page

前端 未结 2 447
情歌与酒
情歌与酒 2020-12-06 23:11

I got a problem with my character encoding. Whenever I load a page in the browser, It shows like this: \"enter

2条回答
  •  一向
    一向 (楼主)
    2020-12-06 23:27

    sounds like you don't serve your content as utf-8. do this by setting the correct header:

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

    in addition to be really sure the browser understands, add a meta-tag:

    
    

    note that, depending on where the text comes from, you might have to check some other things too (database-connection, source-file-encoding, ...) - i've listed a lot of them in one of my answers to a similar question.

提交回复
热议问题