Why do Chrome/Firefox fail choosing the right character encoding?

3

In those two browsers, this web page has all the accented characters displayed as questions marks.

Since the header apparently includes the right infos...

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

... why aren't characters correctly displayed?

I have to manually tell the browsers to use the Windows-1252 text encoding for the characters to be displayed as expected.

Thank you.

OverTheRainbow

Posted 2013-10-14T21:04:54.897

Reputation: 5 153

Answers

3

The characters are displayed correctly according to your headers. You will need to change the character-set in the response header, or encode your data in utf-8. These days, I believe the second option is preferred.

As you appear to be using Apache as your web server you can either output a line like Content-Type: text/html; charset=utf-8\n\n before any page content, or use mod-mime to change the character set using the AddCharset directive.

These are your headers as I retrieved them:

HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Mon, 14 Oct 2013 21:29:36 GMT
Server: Apache
Last-Modified: Sat, 31 Mar 2001 23:36:28 GMT
ETag: "1474dab-a06b-380d60eb17700"
Accept-Ranges: bytes
Content-Length: 41067
Vary: Accept-Encoding
Keep-Alive: timeout=3, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8

BillThor

Posted 2013-10-14T21:04:54.897

Reputation: 9 384

Thanks but it's not my server. I'm just a user wondering why the two browsers failed displaying the data correctly. Does it mean the data is not encoded in Windows-1252, contrary to what the header says? – OverTheRainbow – 2013-10-15T12:08:50.110

The data is encode in Window-1252, but is being decoded as UTF-8. Converting your documentation to UTF-8 will solve the problem, and use a standard character set. – BillThor – 2013-10-15T12:43:12.953