User "Hashar" posted a comment on MediaWiki.r95332.

Full URL: 
https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki/95332#c21372
Commit summary:

* (bug 30441) getParamValue must understand "+" encoding of space

$.param() produces query string form encoding using the traditional '+' 
encoding for space; mediawiki.util.getParamValue() was using only 
decodeURIComponent() to do unescaping, which is not required by spec to handle 
'+'. Explicitly replacing '+' with '%20' before the decode nicely resolves this.

Added a test case to qunit tests for mediawiki.util module.

Comment:

jQuery.param() internally uses encodeURIComponent() and then replace any '%20' 
occurrences with '+' :

 // global jQuery definition:
 var r20 = /%20/g;

 // jQuery.param() returns:
 return s.join( "&" ).replace( r20, "+" );

Comparisons of escape() encodeURI() and encodeURIComponent() can be found with 
examples at:

http://xkr.us/articles/javascript/encode-compare/



_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to