daily pastebin goal
73%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def escape(x)
  2.  
  3.     if (x.encoding.to_s != "ASCII-8BIT")
  4.         raise "wtf"
  5.     end
  6.  
  7.     r = x.empty? ? "%" : CGI.escape(x).gsub("%20", '+')
  8.  
  9.     if (r.encoding.to_s != "ASCII-8BIT")
  10.         raise "wtf"
  11.     end
  12.  
  13.     r
  14. end
  15.  
  16. def unescape(x)
  17.     x == "%" ? "" : CGI.unescape(x, "ASCII-8BIT")
  18. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top