Last active
September 9, 2016 11:48
Revisions
-
axe312ger renamed this gist
Sep 9, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
axe312ger created this gist
Sep 9, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ const reserved = [ ':', '/', '?', '#', '[', ']', '@', // RFC 3986 gen-delims '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=', // RFC 3986 sub-delims '%' // % needs to be encoded to ensure proper decoding ] function utf8EncodeURIComponent (uri) { return Array.from(uri) .map((char) => reserved.includes(char) ? encodeURIComponent(char) : char) .join('') }