diff --git a/lib/prawn/markup/processor.rb b/lib/prawn/markup/processor.rb index d2d9a03..195c743 100644 --- a/lib/prawn/markup/processor.rb +++ b/lib/prawn/markup/processor.rb @@ -49,7 +49,9 @@ def parse(html) reset html = Prawn::Markup::Normalizer.new(html).normalize - Nokogiri::HTML::SAX::Parser.new(self).parse(html) { |ctx| ctx.recovery = true } + Nokogiri::HTML::SAX::Parser.new(self, html.encoding&.to_s).parse(html) do |ctx| + ctx.recovery = true + end end def start_element(name, attrs = [])