UTF-8 in java applet in browser

I have a problem with encoding in a java applet. When I run it in NetBeans, the Russian characters in the applet are fine. No coding issues. But when I launch the same applet through the browser, my Russian characters are displayed as squares (encoding problem).

Where is the problem?

I have Russian translations in .properties files that are UTF-8 encoded. I also tried converting them to UTF-8 using

value = new String(bundle.getString(cLabel).getBytes("ISO-8859-1"), "UTF8"); 

Some ideas?

+4
source share
2 answers

By default, .properties files are standard ISO8859-1, and any characters not represented there must be encoded using escape sequences, see the native2ascii program that comes with the JDK on how to convert them.

+2
source

Pass this property to your applet:

 java_arguments="-Dfile.encoding=utf-8" 

(note that depending on the html code used, the syntax may differ, but the attribute name is java_arguments , and the value is -Dfile.encoding=utf-8 )

0
source

All Articles