Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JVM throws an error when opening some pdf files #11

Open
tkunse opened this issue Oct 6, 2017 · 1 comment
Open

JVM throws an error when opening some pdf files #11

tkunse opened this issue Oct 6, 2017 · 1 comment

Comments

@tkunse
Copy link

tkunse commented Oct 6, 2017

Hello,

Thanks for your great editor. It really helps me a lot.
But I have encountered a minor problem. When I open some pdf files, JVM gives me an error message:
java.io.IOException: Invalid byte 3 of 3-byte UTF-8 sequence.

An example:
http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-57p1r3.pdf

It seems that the error occurs when reading the pdf file. Do you have any way to solve this problem?

Thanks again!

@tkunse
Copy link
Author

tkunse commented Jul 13, 2018

After such a long time, I finally realized what's the problem. (Because I myself have written several Java programs too and experienced several problems when trying to distribute. However, I do not upload the code to github for some security reasons.)
This error message is all caused by the encoding. Since I am using this software on Windows, the system's default encoding is not UTF-8. For this reason alone, Java programs cannot perform normally when reading something that is encoded by UTF-8, such as the metadata in PDF files.
So the solution is to add a -Dfile.encoding=UTF-8 to the JVM option. This can solve most problems. However, when a PDF document is protected using permission passwords, exceptions are thrown again. It is not a serious problem then, for I can just remove the passwords and use this tool.
Sorry for the disturbance (if any).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant