Ruby-RTF
Ruby-RTF copied to clipboard
Nonbreaking space directive "\~" raises NoMethodError
Ran into this while parsing some RTFs in the wild, here's a minimal test case:
{\rtf1 \~}
$ RubyRTF::VERSION
=> "0.0.5"
$ RubyRTF::Parser.new.parse('{\rtf1 \~}')
NoMethodError: undefined method `[]' for nil:NilClass
from [...]/gems/ruby-rtf-0.0.5/lib/ruby-rtf/parser.rb:107:in `parse_control'
Seems like \~
should be a valid directive according to https://www.biblioscape.com/rtf15_spec.htm?
My workaround for now is just to replace instances of \~
with whitespace characters before passing them to RubyRTF::Parser
.