Created
May 8, 2013 05:04
-
-
Save 3cp/5538314 to your computer and use it in GitHub Desktop.
Ruby equivalent code of Javascript encodeURIComponent(...)
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 'uri' | |
# same result as Javascript encodeURIComponent(...) | |
puts URI.escape(ARGV[0], Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment