Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Unicode characters in <code> blocks (browser)

by tye (Sage)
on Oct 08, 2006 at 05:22 UTC ( [id://576939]=note: print w/replies, xml ) Need Help??


in reply to Unicode characters in <code> blocks

It is not a double-encoding bug. Your browser makes the (valid, in this case) assumption that the site expects input in Latin-1 (since that is what it declares its output to be in) and so your browser encodes things that don't fit into Latin-1 as HTML entities (making another assumption that is only partially valid here; that what you are sending will be interpretted as HTML). (Note that not all browsers make these assumptions and so not all browsers will behave this way; though other choices of browser behavior usually have worse outcomes.)

What you send for node content is interpretted as something close to HTML, but the content of CODE tags is just data; it is not interpretted at all beyond looking for the matching ending CODE (or C) tag. And PerlMonks content is Latin-1 so you can't put anything but Latin-1 into PerlMonks CODE tags.

We could try to convert the site to UTF-8, but that's a major project and given how long minor projects take I wouldn't start holding my breath on that. We could come up with a scheme for embedding non-Latin-1 characters in CODE tags (or something like CODE tags except for the Latin-1-ness). Most ideas I've come across for that are ugly in one way or another, usually looking less desirable than converting the site to UTF-8.

- tye        

  • Comment on Re: Unicode characters in <code> blocks (browser)

Replies are listed 'Best First'.
Re^2: Unicode characters in <code> blocks (browser)
by ambrus (Abbot) on Oct 08, 2006 at 11:10 UTC
    (Note that not all browsers make these assumptions and so not all browsers will behave this way; though other choices of browser behavior usually have worse outcomes.)

    Indeed, links-derived browsers behave differently. If you enter non-latin1 characters to a latin1 field, it encodes them as flying accents, not as html entities. (Links already has these tables about converting unprintable characters to approximate ascii sequences becasue that's what it does if a html page contains a character that the encoding of your terminal doesn't support.)

Re^2: Unicode characters in <code> blocks (browser)
by Joost (Canon) on Oct 08, 2006 at 15:23 UTC

      I don't think it's the browser behaiviour that complicates things. You can change the behaiviour of the browser with the accept-charset attribute of the FORM tag to sending data as UTF-8, and then perlmonks would convert that data to 8859_1. The problem is how perlmonks represents posts and renders them, which cannot easily be changed.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-19 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found