arnabmitra
arnabmitra

Reputation: 953

Japanese font apperaring garbled in an applet

I have a Java Swing application JAR running as an applet in a JSP. In one of the JTextfields, a user pastes Japanese language characters, and it shows up garbled. However, when I run the same application as an applet, it shows up just fine. The JSP has the content represented as UTF-8 as per the META tag.

Upvotes: 0

Views: 825

Answers (2)

Chris
Chris

Reputation: 4588

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.

Upvotes: 1

thomasrutter
thomasrutter

Reputation: 117363

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.

Upvotes: 1

Related Questions