Percent Encoding URL and ^

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
" ">
<html xmlns=3D" " xml:lang=3D"en" lang=3D"en">
<a href=3D" ">test</a>

IE6, Opera, Safari 3:

Firefox: ^

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[2] (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,
Appendix B.2
Special characters in URI attribute values[3], 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" ">...</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
more bytes.
|   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
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.


Re: Percent Encoding URL and ^

Quoted text here. Click to load it
Sorry, I meant:

%5E is not converted to '^' , but in Mozilla, it is converted to the
literal '^'

Re: Percent Encoding URL and ^

Quoted text here. Click to load it
Quoted text here. Click to load it

Why not fix the application on the server so it always "unescapes"
everything? That way it doesn't matter.

Re: Percent Encoding URL and ^

On Mon, 24 Nov 2008, dhtml wrote:

Quoted text here. Click to load it

75% of all browsers?

Quoted text here. Click to load it

Give an address (URL) of a test document.

Site Timeline