We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea335df commit 7ecdc5cCopy full SHA for 7ecdc5c
lib/rails/html/sanitizer.rb
@@ -106,8 +106,8 @@ def sanitize(html, options = {})
106
return unless html
107
return html if html.empty?
108
109
- encoding = html.encoding.name == 'ASCII-8BIT' ? 'UTF-8' : html.encoding.name
110
- loofah_fragment = Loofah.fragment(html, encoding)
+ encoding = html.encoding == Encoding::ASCII_8BIT ? Encoding::UTF_8 : html.encoding
+ loofah_fragment = Loofah.fragment(html, encoding.name)
111
112
if scrubber = options[:scrubber]
113
# No duck typing, Loofah ensures subclass of Loofah::Scrubber
0 commit comments