How to fix accent problems in Strings in Jtextpane?

Asked

Viewed 613 times

0

I have an application in Java, I made it in Netbeans. The problem is when there are strings with accents. When run by Netbeans, it shows everything perfect (the string with accents correctly), but when I create the JAR and run it, the strings are shown distorted (when it has accent), for example:

Instead of:

pode atribuir expressão

Appears:

pode atribuir expressão

OBS.: Strings are shown in JTextPane, I have to use it because of the coloring of the strings. In Netbeans is set to be UTF-8, even if I put Windows 1252 or 1256 still happens this error in JAR.

Is there any way to fix it?

  • Add the code to the question so you can reproduce the problem.

  • When run by Netbeans, it shows everything perfect(the string with accents correctly), but when I create the jar and run it, the strings are shown distorted (when it has accent), for example : - How are you creating this JAR? What’s the problem with using the JAR created by Netbeans?

  • I create the JAR when I put it to compile( Netbeans standard creation). The problem is that when I run through Netbeans the words are accented normally but when I do the same thing through the JAR the accented words don’t come out as desired. That’s what I don’t understand.

  • @Beto IE, is it the same JAR? If so, this is strange. Supposedly what Netbeans does underneath the scenes (using ant) is just one java -jar SeuJar.jar.

  • Yes, it’s the same JAR. The GUI was made in swing ( I don’t know if it helps).

  • It would be interesting to add a [mcve] code to the question, so we can simulate the problem.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.