Consider the string: ` ( ?
Javascript's escape()
encodes it like this:
escape("` ( ?")
"%60%20%28%20%3F"
How can I achieve the same effect in Ruby? Nothing I try works:
[Dev]> CGI.escape("` ( ?")
=> "%60+%28+%3F"
[Dev]> URI.encode("` ( ?")
=> "%60%20(%20?"
[Dev]> Addressable::URI.encode("` ( ?")
=> "%60%20(%20?"
ERB::Util.url_encode
will do it:
>> require 'erb'
=> true
>> ERB::Util.url_encode("` ( ?")
=> "%60%20%28%20%3F"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With