Please find the below sample code, The UTF-8 character properly displaying in windows machine. But, its not proper for Linux machine (Ubuntu).
import javax.swing.JOptionPane;
public class JContPaneTest
{
public static void main(String[] args)
{
JOptionPane.showMessageDialog(null, "\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002\u30c7\u30fc\u30bf\u30d9\u30fc", "Error",JOptionPane.ERROR_MESSAGE);
}
}
Is there any way to solve this problem?
Not all fonts contain the full unicode set of glyphs. The blobs are probably the result of a deficient font, but in java it's hard to determine what font is actually being used, and I don't know a way to determine if these blobs are being emitted except by seeing them.
I had huge problems with unicode in pop-up menus, which probably is a very similar problem to yours.
2 things to try.
1) Write a font test to display your string in all fonts that are available to java. 2) Try using a non-swing component. Non-swing components use the underlying OS font support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With