Spa*_*on_ 6 java pdf character-encoding ligature apache-tika
Tika似乎不识别PDF文件中的连字(fi,ff,fl ...)并用问号替换它们.
有什么想法(不仅在Tika上)提取PDF文本,同时将字符连字转换为分离的字符?
File file = new File("path/to/file.pdf");
String text = Tika().parseToString(file);
Run Code Online (Sandbox Code Playgroud)
编辑
我的PDF文件是UTF-8编码(就是说的InputStream.getEncoding()),我的平台编码也是UTF-8.即使有了-Dfile.encoding=UTF8,它也无法正常工作.
例如,我应该有:"différentesimplémentations"......这就是我真正得到的:"di erentesimpl ementations"