module UnescapeHtmlHelper
Decode HTML & URL encodings
Private Instance Methods
unescape_html(text)
click to toggle source
# File lib/parsers/unescape_html_helper.rb, line 7 def unescape_html(text) return if text.nil? && !text.is_a?(String) || text.empty? unescaped_html_text = CGI.unescapeHTML(text) if unescaped_html_text =~ /%[a-z0-9]{2}/i plus_sign_preserved_text = unescaped_html_text.gsub(/\+/, '%2B') unescaped_html_text = CGI.unescape(plus_sign_preserved_text) end unescaped_html_text.strip end