PDFBox提取的文本不包含国际(非英语)字符 [英] Text extracted by PDFBox does not contain international (non-English) characters
本文介绍了PDFBox提取的文本不包含国际(非英语)字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Apache PDFBox从多个PDF文件中提取文本.这些文件使用波兰语,并且包含波兰语字符.不幸的是,当我打印提取的文本时,我不断得到? (问号),而不是这些字符.
I'm using Apache PDFBox to extract text from several PDF files. The files are in Polish language and they contain Polish characters. Unfortunately, when I print the extracted text, I keep getting ? (question marks) instead of those characters.
推荐答案
假设您提取的文本存储在String中,我假设您当前正在使用它来打印-
Assuming your extracted text is stored in String s, I am assuming that you are currently using this to print -
System.out.println(s);
我建议您使用此代码段正确打印出波兰字符-
I suggest you use this snippet for printing out the polish characters properly-
java.io.PrintStream p = new java.io.PrintStream(System.out,false,"UTF-8");
p.println(s);
这应该工作吗?不会出现在打印的文本中.
This should work and ? will not appear in the printed text.
这篇关于PDFBox提取的文本不包含国际(非英语)字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文