In 3/4 browsers, ^ is converted to %5E.
However, in Mozilla, it is not:-
load up the following and click on the link and notice the location
bar:-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
test
IE6, Opera, Safari 3:
http://example.com/?n=%5E
Firefox:
http://example.com/?n=^
My understanding says that firefox is wrong on this one.
Data must be escaped if it does not have a representation using an
unreserved
character.[1]
RFC 3986[2] (Jan 1995) clearly states which characters are allowed in
URLs-
| Characters that are allowed in a URI but do not have a reserved
| purpose are called unreserved. These include uppercase and
lowercase
| letters, decimal digits, hyphen, period, underscore, and tilde.
|
| unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
Copying the generated URIs results in Mozilla following HTML 4.01,
Appendix B.2
Special characters in URI attribute values[3], which
states:-
| Although URIs do not contain non-ASCII values (see [URI], section
| 2.1) authors sometimes specify them in attribute values expecting
URIs
| (i.e., defined with %URI; in the DTD). For instance, the following
href
| value is illegal:
|
...
|
| We recommend that user agents adopt the following convention for
handling
| non-ASCII characters in such cases:
|
| 1. Represent each character in UTF-8 (see [RFC2279]) as one or
more bytes.
| 2. Escape these bytes with the URI escaping mechanism (i.e., by
converting
| each byte to %HH, where HH is the hexadecimal notation of the byte
value).
The "national" and "punctuation" characters (which includes "^") do
not appear
in any productions and therefore may not appear in URLs.[4]
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.
[1]http://www.ietf.org/rfc/rfc2396.txt
[2]http://tools.ietf.org/html/rfc3986#section-2.3
[3]http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.2
[4]http://www.ietf.org/rfc/rfc1630.txt