login/register

Snip!t from collection of Alan Dix

see all channels for Alan Dix

Snip
summary

In all modern browsers (including Mozilla, now that bug ... JavaScript's escape() function (which was originally des... strings into URLs) uses %HH for Unicode codepoints below... %uHHHH for codepoints above there. Apparently, this is w... spec says.

Hacking for Christ: URL Encoding Confusion
http://weblogs.mozillazine.org/gerv/archives/2004/05/url_encoding_co.html

Categories

/Channels/techie

[ go to category ]

For Snip

loading snip actions ...

For Page

loading url actions ...

In all modern browsers (including Mozilla, now that bug 44272 is fixed), JavaScript's escape() function (which was originally designed for escaping strings into URLs) uses %HH for Unicode codepoints below 0x0100, but %uHHHH for codepoints above there. Apparently, this is what the ECMAScript spec says. Where did this strange %u encoding come from? The newer (but not supported by IE 5.0) encodeURIComponent() seems to do the right thing, always encoding each individual byte of the character's representation in UTF-8 as %HH.

HTML

In all modern browsers (including Mozilla, now that <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=44272">bug 44272</a> is fixed), JavaScript's escape() function (which was originally designed for escaping strings into URLs) uses %HH for Unicode codepoints below 0x0100, but %uHHHH for codepoints above there. Apparently, this is what the ECMAScript spec says. Where did this strange %u encoding come from? The newer (but not supported by IE 5.0) encodeURIComponent() seems to do the right thing, always encoding each individual byte of the character's representation in UTF-8 as %HH.