doushantun0614 2016-02-13 04:34
浏览 72
已采纳

设置为charset = UTF8后,网页上未显示的特殊字符

I have an app that developed with JS, PHP and for some reason it is not able to display the Spanish Accents in the dropdown box which the values are from the mysql table. For the same app, it display those Spanish accents without any problem on the windows web server IIS 8.5, but not in the Linux box which running REL 6.5 with apache 2.2 installed.

Here are what I did try and checked.

The charset=UTF-8 already set in the meta header in the html. The php.ini on both servers are set default to UTF-8

Default charset for Apache config file is set to UTF-8.

Checked the locale setting on Linux box to make sure include the es-UTF8 in the sysconfig.

Checked the chrome dev tool by inspect the response header and the content-type showing plain/html , charset=UTF-8, vary: accept encoding.

If I go into the phpMyAdmin and look at the raw table, the accents are stored in the MySQL table and I can search it too inside phpMyAdmin.

  • 写回答

1条回答 默认 最新

  • dongxiao3694 2016-02-13 05:06
    关注

    Run below query before executing actual query:

    mysqli_query($con, 'SET names UTF8');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?