Last active
April 8, 2018 02:53
-
-
Save djberg96/cc84a5ccb135ec1b59b696497319c558 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
require 'addressable' | |
AU = Addressable::URI # less typing | |
url = "https://x.y.com/stuff/abc?api-version%3D2016-03-30%26%24skipToken%3Dabc123%2Bstuff%2Band%2FwU%3D" | |
uri = AU.parse(url) | |
unencoded = AU.unencode(uri) | |
puts unencoded | |
# Got what I expected | |
# https://x.y.com/stuff/abc?api-version=2016-03-30&$skipToken=abc123+stuff+and/wU= | |
encoded = AU.encode(unencoded) | |
puts encoded | |
# Not what I expected. I expected the original string. | |
# https://x.y.com/stuff/abc?api-version=2016-03-30&$skipToken=abc123+stuff+and/wU= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment