URL Encoding and ASCII

If you ever have the validators pass you back that nasty XML error page then this article might be a bit of a clue in debugging. Say you are using url encoding, that’s where you are using PHP and passing a variable to another page simply by putting in your anchor link’s href attribute href=”?name=value” for example. What this does is put the ?name=value at the end of the url when it calls the next page. Its pretty basic. Now look again. Say for some mad and sad reason you decide to pass href=”?name=Sally Brown” what do you think happens? Well it’ll put that “%20″ character into the url to represent a space character. Of course, you could also put the ASCII character for a space into your url encoding to be geeky.

So that could just be why your page fails the validator and returns an XML error - if you wrote “Sally Brown” as a value in a url encoded link? The values will pass correctly and PHP doesn’t give a damn but it can actually trip the validator so keep an eye out.

There are a number of other reasons for this error page but this example will give you an idea of the stuff to look for in your XHTML page if it does.

Comments are closed.


Sitemap