tags:

views:

30

answers:

2

Hi!

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?

A: 

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)

Bozho
AFAIK this can be done only on signed applets. Unfortunately my applet is not signed.
Yurish
Hm, give it a try. It's true that I've used it only on signed applets, but I don't immediately see why you shouldn't be able to set it.
Bozho
+1  A: 

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.

Tassos Bassoukos