Reputation: 1309
I have a problem with encoding in java applet. When I am running it in NetBeans, russian characters in applet are ok. No encoding problems. But, when I am running the same applet through browser, then my russian characters are shown as squares(encoding problem).
Where is the problem?
I have russian translations in .properties files, which has UTF-8 encoding. Also I tried to convert them to UTF-8 using
value = new String(bundle.getString(cLabel).getBytes("ISO-8859-1"), "UTF8");
Some ideas?
Upvotes: 4
Views: 3260
Reputation: 597114
Pass this property to your applet:
java_arguments="-Dfile.encoding=utf-8"
(note that depending on the html code you use, the syntax might be different, but the attribute name is java_arguments
and the value is -Dfile.encoding=utf-8
)
Upvotes: 0
Reputation: 16142
By default, .properties files are plain ISO8859-1, and any characters not represented there must be encoded via escape sequences, see the native2ascii program that comes with the JDK on how to convert them.
Upvotes: 3