Text extracted by PDFBox does not contain internat

2019-07-09 01:29发布

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.

1条回答
爷的心禁止访问
2楼-- · 2019-07-09 02:30

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.

查看更多
登录 后发表回答