File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Can't display chinese and japanese at the same time (Urgent!!!!) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Can Watch "Can New topic

Can't display chinese and japanese at the same time (Urgent!!!!)

S Dan

Joined: Apr 05, 2005
Posts: 25
Ok, the following program tries to display a string that contains mostly japanese characters along with few chinese characters.
When I try "java I18NTest zh ZH" it shows all japanese and chinese characters properly except one.
When I try "java I18NTest ja JA" its shows the japanese fine but messes up the chinese characters.
What do I have to do so that it displays all japanese and chinese characters properly? Following is the java code and the .properties files (both the properties files are same though). I'm sure that the problem has nothing
to do with system fonts as there is a third party java application that shows those characters properly on my machine. Any help will really be appreciated.


import javax.swing.*;
import java.awt.*;
import java.util.*;

public class I18NTest {
public static void main(String args[]) {

String language;
String country;

if (args.length != 2) {
language = new String("en");
country = new String("US");
} else {
language = new String(args[0]);
country = new String(args[1]);

Locale currentLocale;
ResourceBundle messages;

currentLocale = new Locale(language, country);
messages =

Object rows[][] = {
{"test", messages.getString("test")}
Object headers[] = {"L","R"};
JFrame frame = new JFrame("Sample");
JTable table = new JTable(rows, headers);
JScrollPane scrollPane = new JScrollPane(table);
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
frame.setSize(300, 150);



[ November 01, 2005: Message edited by: S Dan ]

[ November 01, 2005: Message edited by: S Dan ]
[ November 03, 2005: Message edited by: S Dan ]
I agree. Here's the link:
subject: Can't display chinese and japanese at the same time (Urgent!!!!)
It's not a secret anymore!