kmoonki / oauth

Automatically exported from code.google.com/p/oauth
0 stars 0 forks source link

Javascript library encodes some chars wrong in Safari #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The method percentEncode uses String.replace to replace a few entries that 
aren't converted in 
encodeURIComponent. I
nstead of using String.replace( regexp, newsubstr ) it uses String.replace( 
substr, newsubstr, 
flags )

But flags are a SpiderMonkey extention, and it fails to work properly in Safari

A quick test ( alert("*****".replace('*', '%2A', 'g')); will alert '%2A****' 
instead of the expected 
%2A%2A%2A%2A%2A

A change to "*****".replace( /\*/g, '%2A' ); solves the issue..

So I have made patch that changes the manual replacements lines to this format..

Original issue reported on code.google.com by morten.f...@gmail.com on 28 Jan 2009 at 1:36

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in -r872.  Thank you for the patch.

Original comment by jmkrist...@gmail.com on 28 Jan 2009 at 6:46