Created
April 12, 2017 22:07
-
-
Save gt3/1963ea47c9cfea79f28178ad6168333c to your computer and use it in GitHub Desktop.
finds difference in encodeURIComponent and encodeURI allowances
This file contains 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
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