Guest User

Untitled

a guest
Feb 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. def _escape(text)
  2. text.gsub(/[^-\w\d\/\n\r _:;+=.\@*,()#]/) do |x|
  3. case x
  4. when '"' : '"'
  5. when '\'' : '''
  6. when '<' : '<'
  7. when '>' : '>'
  8. when '&' : '&'
  9. else
  10. #"&##{x[0]};" # this seemed to cause weird chars
  11. x
  12. end
  13. end
  14. end
Add Comment
Please, Sign In to add comment