Tag: 阿拉伯语

Ruby提取PDF格式的阿拉伯语文本

我通常使用此代码从PDF中提取文本: require ‘rubygems’ require ‘pdf/reader’ filename = File.expand_path(File.dirname(__FILE__)) + “/myfile.pdf” PDF::Reader.open(filename) do |reader| reader.pages.each do |page| puts page.text end end 这次我想解析阿拉伯语PDF,但是,使用这段代码,我得到了一堆奇怪的字符。 例如: ±πNuô ≠ö ¥πbËÊ ´Lö Ë«_°u«» ±GKIW √±U±Nr ËîUÅW √Ê ´bœ Ë≠w «∞LπLuŸ, ¥L 我已经读过那个coding: utf-8对于阿拉伯语很好,所以,有什么解决方案吗?