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}, "'")