Charset=utf8 not working in my PHP page

前端 未结 2 454
情歌与酒
情歌与酒 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条回答
  •  旧时难觅i
    2020-12-06 23:28

    As stated by kraikkonen85 in this comment:

    Besides setting mysql_set_charset and adding utf8 setting metadata to html, another important but "unpredictable" reason is the encoding type of your PHP editor when saving. For example, if you save the php file other than encodings such as "unicode" or "ANSI", as i experienced, you may notice weird chars like squares, question marks etc.

    To make sure, try "save as" method to see explictly that your php file is being saved as utf8.

    it may be because your content might not utf-8 you can set utf-s by setting the header and meta

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

提交回复
热议问题