Skip to content

Instantly share code, notes, and snippets.

@Eugeny
Forked from ralphholzmann/oauthPercentDecode
Created April 1, 2014 09:49
Show Gist options
  • Save Eugeny/9911120 to your computer and use it in GitHub Desktop.
Save Eugeny/9911120 to your computer and use it in GitHub Desktop.
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