开发者

Character encoding problem in my website

开发者 https://www.devze.com 2022-12-24 15:14 出处:网络
I own a website that was recently moved to a different server, now I can see some weird characters. Initially the website was coded with UTF-8 encoding. The weird cha开发者_如何学运维racters disappear

I own a website that was recently moved to a different server, now I can see some weird characters. Initially the website was coded with UTF-8 encoding. The weird cha开发者_如何学运维racters disappears if I change the View > Character encoding to Western(8859-1) in my browser. Therefore, I changed the source of the website to use this Western one, but still I can see the weird characters and they doesn't seem to disappear. Can anyone help me with this. Thanks in advance.


To me, this sounds like your websites were encoded with ISO 8859-1 (rather than UTF-8), but the server sends out the page as UTF-8 instead.

To verify this, you can install Live HTTP Headers for Firefox and check the Content-Type header of the web server response.

If the server indeed sends out the wrong Content-Type, you need to change the server configuration. Since you didn't tell us which web server you use, I cannot give you more specific instructions. ;-)


If you have access to Linux/Unix command line, use the following command to find out the encoding sent by your server: ($ is not part of the command)

$ curl -s --head http://yoursite.com | grep Content-Type

Alternative you can use e.g. Firebug plugin for Firefox to find out value of the Content-Type header sent by the server.

The content type sent by server usually overrides the encoding specified in the document, so it's not enough to just change your http-meta-equiv.


It's odd that you get correct chars when browser forcing ISO-8859-1 if your site is coded in UTF-8. It makes no sense. So unless there is some on-the-fly charset conversion going in in the web server, I suspect that your html is in fact Latin-1 encoded (or at least parts of it).

0

精彩评论

暂无评论...
验证码 换一张
取 消