From c8835261b0385adfbffd7060039cd2970824f29e Mon Sep 17 00:00:00 2001 From: Janiss Binder Date: Mon, 16 Dec 2024 12:24:52 +0100 Subject: [PATCH] Make SAX Parser nokogiri 17 compatible Due to changes in nokogiri 17, the SAX parser now needs a default encoding: https://github.com/sparklemotion/nokogiri/pull/3288 --- lib/prawn/markup/processor.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/prawn/markup/processor.rb b/lib/prawn/markup/processor.rb index d2d9a03..1bfff44 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, ::Encoding::UTF_8).parse(html) do |ctx| + ctx.recovery = true + end end def start_element(name, attrs = [])