lib/rpdf2txt/text.rb in rpdf2txt-0.8.2 vs lib/rpdf2txt/text.rb in rpdf2txt-0.8.3
- old
+ new
@@ -62,11 +62,10 @@
&& (ascii = SymbolMap::SYMBOL_ENTITIES[unicode_bytes]))
ascii.chr
elsif((map = @current_font.to_unicode) \
&& (utf8 = map.to_utf8(ascii)))
@current_font.attributes[:encoding] = '/UTF8'
- #@text_state.set_font(@current_font)
[utf8].pack('U')
end
end
end
def scan
@@ -163,10 +162,10 @@
end
def snip(snippet)
snippet_text = snippet[1..-2].gsub(/\\[nrt]/n, " ")
snippet_text.gsub!(/\\([()])/n, '\1')
snippet_text.gsub!(/./n) { |char|
- self.mapped_ascii(char[0]) || char
+ self.mapped_ascii(char.unpack('C*')[0]) || char
}
_snip(snippet_text)
end
def _snip(snippet_text)
@text_state.set_txt(snippet_text)