PHP Include and accents (They show up as �)

后端 未结 5 1595
陌清茗
陌清茗 2020-12-17 23:08

I\'m using PHP include to include a PHP file that has HTML in it. some of the content has french accents and these show up as � on the site. How can this be solved?

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-18 00:08

    That happens if the browser thinks your using another encoding than you actually use.

    try to add the following in your php file before any html is printed:

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

    and add

    
    
    
    

    between the tags

    UPDATE: just saw your update with the file. you need to add header ('Content-type: text/html; charset=utf-8');

提交回复
热议问题