Skip to content

Instantly share code, notes, and snippets.

@thebigbad
Created January 6, 2011 19:45
Show Gist options
  • Select an option

  • Save thebigbad/768451 to your computer and use it in GitHub Desktop.

Select an option

Save thebigbad/768451 to your computer and use it in GitHub Desktop.
var chars = [
"$", "-", "_", ".", "+",
"<", ">", "#", "%", '"', "{", "}", "|", "\\", "^", "~", "[", "]", "`", "!",
"*", "'", "(", ")", ",", ";", "/", "?", ":", "@", "&", "="
];
console.log(
chars.map(function (c) { return escape(c); }).
map(function (c) { return escape(unescape(c)); })
);
/*
~$ node test.js
[ '%24'
, '-'
, '_'
, '.'
, '+'
, '%3C'
, '%3E'
, '%23'
, '%25'
, '%22'
, '%7B'
, '%7D'
, '%7C'
, '%5C'
, '%5E'
, '%7E'
, '%5B'
, '%5D'
, '%60'
, '%21'
, '*'
, '%27'
, '%28'
, '%29'
, '%2C'
, '%3B'
, '/'
, '%3F'
, '%3A'
, '@'
, '%26'
, '%3D'
]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment