Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: PerlMonks main page: garbled character encoding

by jdporter (Paladin)
on Mar 22, 2021 at 13:50 UTC ( [id://11130122]=note: print w/replies, xml ) Need Help??


in reply to Re: PerlMonks main page: garbled character encoding
in thread PerlMonks main page: garbled character encoding

Interesting. When viewing the page not logged in, Firefox reports the following info:

  • Type: text/html
  • Render Mode: Quirks mode
  • Text Encoding: GBK
When logged in, Firefox reports the following info:
  • Type: text/html
  • Render Mode: Quirks mode
  • Text Encoding: windows-1252

Why would the encoding be different? I think the browser is inferring the encoding from the page's content... and the content is different if you're logged in.

  • Comment on Re^2: PerlMonks main page: garbled character encoding

Replies are listed 'Best First'.
Re^3: PerlMonks main page: garbled character encoding
by LanX (Saint) on Mar 22, 2021 at 14:26 UTC
    Firefox shows me the HTTP header Content-Type:text/html when I'm not logged in.

    The ; charset=Windows-1252 part is missing.

    HTTP/1.1 200 OK Date: Mon, 22 Mar 2021 14:27:09 GMT Server: Apache Last-Modified: Mon, 22 Mar 2021 14:27:05 GMT ETag: "efc2-5be20dc244d70" Accept-Ranges: bytes Content-Length: 61378 Keep-Alive: timeout=5, max=98 Connection: Keep-Alive Content-Type: text/html

    A check in Chrome shows the same:

    HTTP/1.1 200 OK Date: Mon, 22 Mar 2021 14:19:57 GMT Server: Apache Last-Modified: Mon, 22 Mar 2021 14:18:09 GMT ETag: "effb-5be20bc33b176" Accept-Ranges: bytes Content-Length: 61435 Content-Type: text/html

    Logged in (FF)

    HTTP/2 200 OK date: Mon, 22 Mar 2021 14:24:41 GMT server: Apache content-type: text/html; charset=Windows-1252 X-Firefox-Spdy: h2

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

    update

    That's RAT no log-in ... charset=Windows-1252 is back

    HTTP/1.1 200 OK Date: Mon, 22 Mar 2021 15:15:43 GMT Server: Apache Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=Windows-1252

      OK, that would suggest that it's the server, rather than the browser, making the (weird) charset determination. In any case, I'm 99.9% sure it's not the PM Engine doing it.

        I can confirm with curl that I receive different headers from the server, depending on whether or not I send my login cookie. (I obfuscated the value of my cookie for pasting.) This agrees with what I see in Chrome's developer tools network inspection, which lists headers without a charset in anonymous/incognito, vs headers with charset in my tab where I'm logged in.

        C:\Users\Peter>curl --head https://perlmonks.org HTTP/1.1 200 OK Date: Mon, 22 Mar 2021 22:14:50 GMT Server: Apache Upgrade: h2,h2c Connection: Upgrade Last-Modified: Mon, 22 Mar 2021 22:12:10 GMT ETag: "ee70-5be275b693fc1" Accept-Ranges: bytes Content-Length: 61040 Content-Type: text/html C:\Users\Peter>curl --cookie "userpass=XXXXXXXXXXXXXXXXXXXXXXXXXXXX" - +-head https://perlmonks.org HTTP/1.1 200 OK Date: Mon, 22 Mar 2021 22:14:26 GMT Server: Apache Upgrade: h2,h2c Connection: Upgrade Content-Type: text/html; charset=Windows-1252

        -- edit: sorry, first time I posted, I misread the statement, so I deleted one sentence where I commented based on my misreading.

Re^3: PerlMonks main page: garbled character encoding
by footpad (Abbot) on Mar 22, 2021 at 21:55 UTC
    In this day and age, one wonders why we're not using:
    <!DOCTYPE html> <head> <meta charset="utf-8"> <!-- ... -->

    --f

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11130122]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-16 06:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found