Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def escape(x)
- if (x.encoding.to_s != "ASCII-8BIT")
- raise "wtf"
- end
- r = x.empty? ? "%" : CGI.escape(x).gsub("%20", '+')
- if (r.encoding.to_s != "ASCII-8BIT")
- raise "wtf"
- end
- r
- end
- def unescape(x)
- x == "%" ? "" : CGI.unescape(x, "ASCII-8BIT")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement