From 78af1da263dff7baf2c61733d84b2cb514a35685 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..3516d38 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, 'UTF-8').parse(html) do |ctx| + ctx.recovery = true + end end def start_element(name, attrs = [])