Sunday, May 20, 2012

Firefox urlencode lapse, or ?


I was validating an HTML page at kanji.aule-browser.com today when I hit a few URL errors in anchor links.

The URL's were added ad hoc for kanji from pages found in Firefox and the URL copied out of the address field.

Oops!  These URL's are for kanji stroke order diagrams and the URL includes a Japanese character.  The URL comes back from Firefox address bar "COPY" with the kanji character urlencoded. But: the URL includes a param following an ampersand and THAT was not encoded.

According to w3c the URL is not valid unless the ampersand is escaped (but the links were tested and worked fine ...)

Once the ampersand was escaped,  the HTML validator stopped objecting - but the "?" for the start  of parameters was still not escaped!

Here is what Firefox returns:

http://www.sp.cis.iwate-u.ac.jp/icampus/u/akanji.jsp?k=%E9%9A%A3&o=e99aa3

Here is what the HTML validator insists upon:

http://www.sp.cis.iwate-u.ac.jp/icampus/u/akanji.jsp?k=%E9%9A%A3&o=e99aa3

Notice that %26 is not what is required for this URL to work correctly.

http://www.sp.cis.iwate-u.ac.jp/icampus/u/akanji.jsp?k=%E9%9A%A3%26o=e99aa3

Firefox reports the URL on my web page as

http://www.sp.cis.iwate-u.ac.jp/icampus/u/akanji.jsp?k=%E9%9A%A3&o=e99aa3

The HTML anchor attribute on the page is now set to

href="http://www.sp.cis.iwate-u.ac.jp/icampus/u/akanji.jsp?k=%E9%9A%A3&o=e99aa3"


The kanji is




No comments: