String.toQueryParams in Prototype.js doesn't decode querystring
encoded by some programs properly because 'decodeURIComponent'
doesn't convert charactor '+' to "%20". In some programs , such as
'Server.UrlEncode' in ASP.NET, encode single whitespace as '+', not
'%20'.
For example:
in ASP.NET web form
String s = "This is a test";
String encodedS = Server.UrlEncode(s); // encodedS will be "This+is
+a+test";
But in javascirpt:
var encodedStringByAspNet = ""This+is+a+test";
var s = decodeURIComponent(encodedStringByAspNet ); // s will be
"This+is+a+test". '+' s are not decoded!
We can do this in javascript:
var s = decodeURIComponent(encodedStringByAspNet.replace(/\+/g,
"%20")); // s will be "This is a test." !
I believe it will make String.toQueryParams more rebust.
Best
regards,
Matthew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---