From c84b7461f8cc729b593dac186206683664a9932e Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Date: Mon, 27 May 2019 06:44:50 +0530 Subject: [PATCH] Bypass Encoding::CompatibilityError --- lib/ruby-rtf/parser.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ruby-rtf/parser.rb b/lib/ruby-rtf/parser.rb index ad5b0d5..13bb40d 100644 --- a/lib/ruby-rtf/parser.rb +++ b/lib/ruby-rtf/parser.rb @@ -208,7 +208,11 @@ def handle_control(name, val, src, current_pos) else [val].pack('U*') end - current_section[:text] << char + begin + current_section[:text] << char + rescue Encoding::CompatibilityError => e + nil + end end when *[:rquote, :lquote] then add_modifier_section({name => true}, "'")