views:

1053

answers:

2

I don't have a use case for this but I was recently asked this very question and w3schools helpfully tells you the characters are ignored but not why.

Anyone have any idea why this might be the case?

Thanks, David

+7  A: 

The escape function is deprecated. Use encodeURI and encodeURIComponent instead.

Gumbo
The funy thing is that encodeURIComponent that was only implemented by Mozilla in Javascript 1.5 was implemented by IE all the way back to IE 5.5.
Paulo Santos
+3  A: 

From your source: "The escape() function encodes a string, so it can be read on all computers." Those characters are standard in the ASCII set, so there's no point in encoding them for this particular purpose.

DXL
This misses the point - the aim is to be able to safely transmit a string inside a *Uri*, which itself uses particular characters for reserved purposes.
Eamon Nerbonne