2

I have a JEditorPane with HTML form and one <input name="rword" type="text"> inside. I'm getting user input by catching FormSubmitEvent with .getData() method.

The mystical thing is that, if I run the app in Netbeans IDE, everything is ok - I get URL encoded input in UTF-8, as expected.

But if I run the jar file from command prompt, getData() returns the user input in ANSI encoding!

I.e. If I type ф in the form, getData will return rword=%D1%84 as expected, but from command line it returns rword=%F4! And I didn't find any method to detect encoding. All my experiments with setting content type with charset=utf-8 have failed. Any ideas?

0

1 Answer 1

2

The problem is in default charset, so run jvm with file.encoding=UTF-8 option

java -Dfile.encoding=UTF-8 -jar jarfile.jar

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.