Skip to content | Sauter la navigation | Reading comfort | Confort de lecture

Real-life validation

I read Jim Byrne’s Accessible Design tips newsletter and like it.

Yet his last tip on validation made me react: He says that in order to avoid validation problem URLs should be encoded, so that ampersands don’t display as "&" but as "&":

For all urls in web pages that contain ampersands, i.e., replace each ampersand (&) in urls embedded within your pages, with the equivalent entity (&), e.g.,

http://www.mcu.org.uk/showlog.php?weblogid=74&contentid=1

Needs to be modified to,

http://www.mcu.org.uk/showlog.php?weblogid=74&contentid=1

Another validation problems solved.

Well, yes and no.

I wrote in 2003 a small addon to Spip, the french CMS, to turn its (then) slightly bugged HTML4.01 into clean XHTML1, and I even went so far as to consider URL ampersanding, like Jim advises here.

The trouble is that ampersanding renders some URLs useless. Try this for instance:
http://www.google.fr/search?hl=fr&ie=UTF-8... is a simple "&" query
http://www.google.fr/search?hl=fr&ie=UTF-8&... is an escaped query.

And lo! The second one does not work because the server is not configured to understand escaped URLs.

Thus the link, although validated, is useless. And there is no blaming Google, because they aren’t an exception: most servers do not understand espaced query strings.

It’s one of the few things I hate about XHTML. URLs shouldn’t be escaped in the first place, period. Why should the parser worry about data which is correct and ’protected’, so to speak, inside double quotes, which are, too, compulsory in xhtml?

So, which is more correct? A small "I do validate" button and an unusable website, or a flaky validation and usable URLs? I chose to go the latter way.

Comments: share your thoughts! RSS

  • > Real-life validation (20 August 2004, by Patrick H. Lauke)

    actually, i’m sorry to say, but you’re wrong. your system encodes the ampersand twice, and that’s why it’s not working for you- and why you then claim that most servers are not set up to deal with escaped ampersand.

    the reality is: if you escape your ampersand correctly in your link, your BROWSER turns it into a single ampersand when you click the link. so, you’re never passing the escaped string to the server.

    whatever character replacement you’re doing, is encoding it so that the escaped ampersand is sent, thus breaking the url.

    just have a look at the source code of your "broken" link, and you’ll see what i mean. then, go and have a look at the example page i’ve set up, have a look at the source code for THAT link, and click it.

    example of how to do it properly

    Reply to this message

  • > Real-life validation (21 August 2004, by Stéphane, in reply to Patrick H. Lauke)

    Damn, you’re right Patrick. So much for my geekiness... ;)

    Thank you, now I understand how it can be used without too much trouble on an xhtml page (and now I seem to be able to patch my addon for a better xhtml compatibility).

    My public apologies should go to Jim as well.

    Reply to this message