Created
March 28, 2014 16:08
-
-
Save moimikey/8f4f61bd4e7b3018b7b3 to your computer and use it in GitHub Desktop.
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
Util.encodeRFC5987 = (string) -> | |
encodeURIComponent(string) | |
# Note that although RFC3986 reserves "!", RFC5987 does not, | |
# so we do not need to escape it | |
.replace(/['()]/g, escape) | |
.replace(/\*/g, '%2A') | |
# The following are not required for percent-encoding per RFC5987, | |
# so we can allow for a little better readability over the wire: |`^ | |
.replace(/%(?:7C|60|5E)/g, unescape) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment