Skip to content

Instantly share code, notes, and snippets.

@karlpokus
Created September 13, 2016 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlpokus/23a0ac762bfdac7261e8aca5c57da1f7 to your computer and use it in GitHub Desktop.
Save karlpokus/23a0ac762bfdac7261e8aca5c57da1f7 to your computer and use it in GitHub Desktop.
encode urls in js. Safe characters and what-not.

encode URLs

src

TL;DR

  • encodeURI() will not encode ~!@#$&*()=:/,;?+' Use on entire string
  • encodeURIComponent() will not encode: ~!*()' Use on tricky values. Will ruin = and &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment