UTF-8 encoded html pages show � (questions marks) instead of characters

后端 未结 7 1144
暖寄归人
暖寄归人 2020-11-27 05:32

I have the standard XAMPP installation on win7 (x64). Having had my share of encoding troubles in a past project where mysql encoding did not match with the php enconding wh

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 06:21

    The problem is the charset that is being used by apache to serve the pages. I work with Linux, so I don't know anything about XAMPP. I had the same problem too, what I did to solve the problem was to add the charset to the charset config file (It is commented by default).

    In my case I have it in /etc/apache2/conf.d/charset but, since you're using Windows the location is different. So I'm giving you this like an idea of how to solve it.

    At the end, my charset config file is like this:

    # Read the documentation before enabling AddDefaultCharset.
    # In general, it is only a good idea if you know that all your files
    # have this encoding. It will override any encoding given in the files
    # in meta http-equiv or xml encoding tags.
    
    AddDefaultCharset UTF-8
    

    I hope it helps.

提交回复
热议问题