Skip to content

Instantly share code, notes, and snippets.

@gt3
Created April 12, 2017 22:07
Show Gist options
  • Save gt3/1963ea47c9cfea79f28178ad6168333c to your computer and use it in GitHub Desktop.
Save gt3/1963ea47c9cfea79f28178ad6168333c to your computer and use it in GitHub Desktop.
finds difference in encodeURIComponent and encodeURI allowances
let arr = [], arr2 = []
for(let i=0; i<200; i++)
{
let s = String.fromCharCode(i)
if(s === encodeURIComponent(s)) arr.push(s)
if(s === encodeURI(s)) arr2.push(s)
}
//arr - // !'%()*-.~
console.log(arr.length, arr2.length)
console.log(arr2.filter(x => !arr.includes(x)))
//[#$&+,/:;=?@]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment