Skip to content

Instantly share code, notes, and snippets.

@the1sky
Last active March 30, 2017 18:45
Show Gist options
  • Save the1sky/5c3cdde606c68c3bbf8538a935b8adf7 to your computer and use it in GitHub Desktop.
Save the1sky/5c3cdde606c68c3bbf8538a935b8adf7 to your computer and use it in GitHub Desktop.
difference between encodeURI and encodeURLComponent
var arr = [];
for(var i=0;i<256;i++) {
var char=String.fromCharCode(i);
if(encodeURI(char)!==encodeURIComponent(char)) {
arr.push({
character:char,
encodeURI:encodeURI(char),
encodeURIComponent:encodeURIComponent(char)
});
}
}
console.table(arr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment