views:

284

answers:

2

i have a java swing application jar running as an applet in a jsp.In one of the JTextfields a user cuts pastes japanese language characters and this shows up garbled.However when i run the same application as an applet from RAD it shows up just fine.Also the JSP have the content to be represented as UTF-8 as per the META tag.

A: 

There are a few possibilities I guess. Boxes may be shown when the display thinks that it is a valid character, but it is unable to find a glyph (entry in the font) corresponding to that character.

Is it possible that you don't have a font installed which contains those characters? Or even that the applet is unable to map these code points to a certain font in your system?

If the problem were due to a mismatch between expected and actual character encoding, I think it would not just be boxes, but it would also probably contain incorrect characters, ie gobbledy-gook.

thomasrutter
A: 

I've had a little experience with Japanese localisation issues so I'll try to offer a possible solution (although quite late).

The JSP content encoding has nothing to do with the encoding used by the applet. The applet is using the user default user JRE/JVM settings.

Assuming that the Japanese appears to the user on at least one screen, this is an issue with the copy and paste manager not knowing how to copy the text (its copying the bytes of the text but then when pasting its re-assembling the bytes incorrectly):

Add a diagnostic screen to the app and log the following system properties on your computer and the user computer:

System.getProperty("xx");
  • file.encoding
  • user.country
  • user.language

Upon start-up of the applet, you should be able to override the properties with your own correct settings to get the correct behavior on all user PCs.

Chris