views:

51

answers:

1

Hi,

I have a little strange problem.

I am working on a java web start application(using swing) which paints a particular image on the (canvas)JPanel. Some of the placeholders on it have some non ASCII characters as their text.

Now when that image is being painted on the canvas, the canvas shows '[]' as if it is unable to recognize the native representation of these UTF-8 encoded characters. But when I click on these placeholders, their property listeners show up a dialog box on which the user is allowed to edit the text held by them. Now, strangely enough these dialog boxes show the NON ASCII text in their true and correct representation(means i can edit this text).

Now this defies my conception that may be the OS does not have the native representation of these characters. Although, East Asian Language support is already installed on my system with windows 7 on it.

Even more strangely when I run the same app from the browser on my RHEL5 desktop, it shows the correct representation on the canvas as well as in the dialog boxes which kind of defies the conception that there is a problem in the code behind this app.

For now I am confused what would probably cause this.
Could someone please help me out !

Thanks,
kshtjsnghl

+1  A: 

Chances are it's just a matter of the font that's being used not supporting those characters. Try changing it to a font which you know is capable of supporting the characters you need.

Jon Skeet
But the problem is that the same characters are being correctly represented when you open them in a different dialog. Which kind of implies that font supports these characters.
kshtjsnghl
@kshtjsnghl: No, quite the opposite. The fact that the characters are being shown correctly in a different dialog suggests that the *data* is correct, and it's a *display* issue... which leads back to the font cause. Try setting the font of the control which doesn't work to be the same as the one which *does* work.
Jon Skeet
Further issue is that both of them are representing the text correctly on the linux system.
kshtjsnghl
@kshtjsnghl: That's even more suggestive that it's a rendering issue... again, look for fonts which will do what you need.
Jon Skeet
Further looking into the issue, I found out that in our application we are actually setting the UIManager's look and feel depending on the Operating system it is running(which is recognised internally) on i.e. system fonts are used.And the font used on the linux box is different from the font used on the windows client and that font is not being shown on the windows client.Could anyone help me know which font can be used on the Windows which will render the complete canvas successfully.
kshtjsnghl