Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Percent Encoding URL and ^
November 24, 2008, 7:16 pm
rate this thread
However, in Mozilla, it is not:-
load up the following and click on the link and notice the location
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns=3D"http://www.w3.org/1999/xhtml " xml:lang=3D"en" lang=3D"en">
<a href=3D"http://example.com/?n=3D%5E ">test</a>
IE6, Opera, Safari 3:
My understanding says that firefox is wrong on this one.
Data must be escaped if it does not have a representation using an
RFC 3986 (Jan 1995) clearly states which characters are allowed in
| Characters that are allowed in a URI but do not have a reserved
| purpose are called unreserved. These include uppercase and
| letters, decimal digits, hyphen, period, underscore, and tilde.
| unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
Copying the generated URIs results in Mozilla following HTML 4.01,
Special characters in URI attribute values, which
| Although URIs do not contain non-ASCII values (see [URI], section
| 2.1) authors sometimes specify them in attribute values expecting
| (i.e., defined with %URI; in the DTD). For instance, the following
| value is illegal:
| <A href=3D"http://foo.org/H=E5kon ">...</A>
| We recommend that user agents adopt the following convention for
| non-ASCII characters in such cases:
| 1. Represent each character in UTF-8 (see [RFC2279]) as one or
| 2. Escape these bytes with the URI escaping mechanism (i.e., by
| each byte to %HH, where HH is the hexadecimal notation of the byte
The "national" and "punctuation" characters (which includes "^") do
in any productions and therefore may not appear in URLs.
It gets worse. When setting innerHTML on an element, if the new HTML
string has a '^', mozilla turns that into %5E, but all other browsers
leave it as '^'.
Our application uses ^ literally. The URL handling service must send
and receive the same characters. This can be either %5E or ^. If
sending %5E to the client, if ^ comes back, the server will not use
that as a key, and if '^' is sent to the client and %5E comes back,
the server will not compare them as being equal.