[Solved] ANSI (windows-1252) not rendered properly

Support and discussions for the x86/x64 Linux version of Pale Moon and specific Linux distribution questions related to the browser.

Moderator: trava90

Forum rules
If your question is about general use of the browser and not specific to Linux, then please use the General Support board.
Locked
User avatar
markfilipak
Lunatic
Lunatic
Posts: 271
Joined: 2015-02-26, 22:23
Location: Mansfield, Ohio, U.S.A.

[Solved] ANSI (windows-1252) not rendered properly

Post by markfilipak » 2015-10-09, 03:32

Solution: https://forum.palemoon.org/viewtopic.php?f=37&t=9809&p=70799#p70799


Hi All. I'm posting a page on my server, but the ANSI code point 0xE5 isn't being rendered properly (note that ANSI == windows-1252). I can't figure out why. Here's the top of the page.

Code: Select all

<!DOCTYPE html><html><head><meta http-equiv="Content-Type"content="text/html; charset=windows-1252"><style type="text/css">i{font-family:serif;font-size:1.1em}p{padding:0 0 0.5em 0;margin:0}</style></head><body style="background-color:gray;font-family:sans-serif;font-size:12pt"><div style="background-color:white;width:40em;margin:0 auto;padding:12pt">
It seems that the "windows-1252" is not being honored. It's being honored for other peoples' pages, but not mine. :cry:

When I load the page and click View > Character Encoding, 'UTF-8' is selected. If I change it to 'windows-1252' (or to 'ISO-8859-1'), the page renders properly, including ANSI code point 0xE5, but if I reload the page, it screws up again.

I changed the character from 'å' to '&aring;' as a work-around, but I'd really like to know what's going on. Got any ideas?

Thank You.
Last edited by markfilipak on 2015-11-22, 19:11, edited 4 times in total.

squarefractal

Re: ANSI (windows-1252) not rendered properly

Post by squarefractal » 2015-10-09, 04:03

You may want to check whether your server is giving out conflicting information in the headers about the encoding of the HTML file.

User avatar
markfilipak
Lunatic
Lunatic
Posts: 271
Joined: 2015-02-26, 22:23
Location: Mansfield, Ohio, U.S.A.

Re: ANSI (windows-1252) not rendered properly

Post by markfilipak » 2015-10-09, 05:33

squarefractal wrote:You may want to check whether your server is giving out conflicting information in the headers about the encoding of the HTML file.
Good idea, but the code I posted is the header as shown in "View Page Source".

squarefractal

Re: ANSI (windows-1252) not rendered properly

Post by squarefractal » 2015-10-09, 07:07

"Header" as in "the HTTP Content-type: header" sent by the server, not the <meta> tag inside the <head> section of the HTML document.

User avatar
markfilipak
Lunatic
Lunatic
Posts: 271
Joined: 2015-02-26, 22:23
Location: Mansfield, Ohio, U.S.A.

Re: ANSI (windows-1252) not rendered properly

Post by markfilipak » 2015-10-09, 16:58

squarefractal wrote:"Header" as in "the HTTP Content-type: header" sent by the server, not the <meta> tag inside the <head> section of the HTML document.
Well, you're pretty smart...

Code: Select all

HTTP/1.1 200 OK
Date: Fri, 09 Oct 2015 16:52:53 GMT
Server: Apache
Last-Modified: Fri, 09 Oct 2015 03:17:21 GMT
Etag: "d7010-3502-6aef3240"
Accept-Ranges: bytes
Content-Length: 13570
Connection: close
Content-Type: text/html; charset=UTF-8
captured by Live HTTP Headers plug-in.
I don't know how to change that at the server, so I'll just have to live with it.

squarefractal

Re: ANSI (windows-1252) not rendered properly

Post by squarefractal » 2015-10-10, 12:37

If you're using a hosting service that allows you to change the server configuration, look into its configuration files. For Apache, look here:
https://stackoverflow.com/questions/913 ... for-server

User avatar
markfilipak
Lunatic
Lunatic
Posts: 271
Joined: 2015-02-26, 22:23
Location: Mansfield, Ohio, U.S.A.

Re: ANSI (windows-1252) not rendered properly

Post by markfilipak » 2015-10-10, 16:06

squarefractal wrote:If you're using a hosting service that allows you to change the server configuration, look into its configuration files. For Apache, look here:
https://stackoverflow.com/questions/913 ... for-server
Actually, it's my own server.

UTF-8 is fine with me. I have a text editor that allows me to write UTF-8, so I configured it and my problem's solved.

Thanks for your help. You provided the guidance I needed regarding HTTP headers. Mystery solved.

User avatar
markfilipak
Lunatic
Lunatic
Posts: 271
Joined: 2015-02-26, 22:23
Location: Mansfield, Ohio, U.S.A.

Re: [Solved] ANSI (windows-1252) not rendered properly

Post by markfilipak » 2015-11-22, 19:10

My server puts out UTF-8. That is, the HTTP headers include a 'Content-Type: text/html; charset=UTF-8' directive. In contrast, the HTML pages on my server specify '<meta http-equiv="Content-Type"content="text/html; charset=windows-1252">'. So as you see, the server's HTTP header and the HTML 'meta'-tag are colliding. Apparently, the HTTP header is winning. The result: ANSI (windows-1252) characters are being interpreted as UTF-8 (which causes the characters past 7F (hex) to be botched). I've changed all my server HTML source text to UTF-8 and changed the '<meta http-equiv=...>' HTML-tag to this: '<meta http-equiv="Content-Type"content="text/html; charset=UTF8">'. But this makes me wonder what good is a '<meta http-equiv=...>' tag if browsers are going to ignore it. Ah, well...

PS: I guess I was thinking that a '<meta http-equiv=...>' HTML tag created an override (changing the text specification from the server's 'UTF-8' to the web page's 'windows-1252'). I guess a '<meta http-equiv=...>' HTML tag is NOT an override, but is instead meant to cover situations in which the server does not specify any encoding in its HTTP headers.
Last edited by markfilipak on 2015-11-22, 19:17, edited 1 time in total.

User avatar
New Tobin Paradigm
Knows the dark side
Knows the dark side
Posts: 8073
Joined: 2012-10-09, 19:37
Location: I'm.. over there.

Re: [Solved] ANSI (windows-1252) not rendered properly

Post by New Tobin Paradigm » 2015-11-22, 19:13

HTTP headers take precedence over what the content says it is. This I believe is correct spec behavior. That's why.
Your computer has too much computer in it and not enough typewriter.
Image

User avatar
markfilipak
Lunatic
Lunatic
Posts: 271
Joined: 2015-02-26, 22:23
Location: Mansfield, Ohio, U.S.A.

Re: [Solved] ANSI (windows-1252) not rendered properly

Post by markfilipak » 2015-11-22, 19:18

Matt A Tobin wrote:HTTP headers take precedence over what the content says it is. This I believe is correct spec behavior. That's why.
Hi Matt,

You posted this while I was adding my PS. What do you think of the PS? Regards - Mark.

User avatar
New Tobin Paradigm
Knows the dark side
Knows the dark side
Posts: 8073
Joined: 2012-10-09, 19:37
Location: I'm.. over there.

Re: [Solved] ANSI (windows-1252) not rendered properly

Post by New Tobin Paradigm » 2015-11-22, 19:38

Yeah, the only thing to add to your PS is.. Also situations where there isn't actually a server as well :thumbup:
Your computer has too much computer in it and not enough typewriter.
Image

User avatar
markfilipak
Lunatic
Lunatic
Posts: 271
Joined: 2015-02-26, 22:23
Location: Mansfield, Ohio, U.S.A.

Re: [Solved] ANSI (windows-1252) not rendered properly

Post by markfilipak » 2015-11-22, 20:13

Matt A Tobin wrote:Yeah, the only thing to add to your PS is.. Also situations where there isn't actually a server as well :thumbup:
Well, I know some things, but I'm shockingly ignorant of other things ... for the sake of my education, I must ask: how can web pages be served without a server?

Thanks!

User avatar
New Tobin Paradigm
Knows the dark side
Knows the dark side
Posts: 8073
Joined: 2012-10-09, 19:37
Location: I'm.. over there.

Re: [Solved] ANSI (windows-1252) not rendered properly

Post by New Tobin Paradigm » 2015-11-22, 21:00

Open them locally (technically open them from a filesystem local or network) :P
Your computer has too much computer in it and not enough typewriter.
Image

User avatar
markfilipak
Lunatic
Lunatic
Posts: 271
Joined: 2015-02-26, 22:23
Location: Mansfield, Ohio, U.S.A.

Re: [Solved] ANSI (windows-1252) not rendered properly

Post by markfilipak » 2015-11-23, 00:22

Matt A Tobin wrote:Open them locally (technically open them from a filesystem local or network) :P
Duh! ...And I thought you were going to cite something stunning. Hahahahahahahaha... (just having some fun with you -- Ciao, & Thanks).

Locked