Created
May 25, 2011 14:32
-
-
Save ralphholzmann/991080 to your computer and use it in GitHub Desktop.
encodeURIComponent doesn't follow rfc3986 that oauth requires. This is my fix...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var oauthPercentEncode = (function(){ | |
var escapeChars = "!*'();:@&=+$,/?%#[]", | |
matchChars = new RegExp( "([\\" + ( escapeChars.split('').join('\\')) + "])", "gi"); | |
return function( p ) { | |
return p.replace( matchChars, function( char ) { | |
return '%' + ( "" + char ).charCodeAt(0).toString(16).toUpperCase(); | |
}) | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment