aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Posting it again (Urgent!) Can't display chinese and japanese font at the same time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Posting it again (Urgent!) Can Watch "Posting it again (Urgent!) Can New topic
Author

Posting it again (Urgent!) Can't display chinese and japanese font at the same time

S Dan
Greenhorn

Joined: Apr 05, 2005
Posts: 25
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.
Thanks.
-Dan

*******************************************************************
I18NTest.java

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);
System.getProperties().put("user.language",language);
messages =
ResourceBundle.getBundle("MessagesBundle",currentLocale);

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);
frame.setVisible(true);
}
}
*******************************************************************
MessagesBundle_ja_JA.properties

test=\u4E2D\u56FD\u8BED\u9891\u9053\u3A00\u2000\u94C3\u6728
*******************************************************************
MessagesBundle_zh_ZH.properties

test=\u4E2D\u56FD\u8BED\u9891\u9053\u3A00\u2000\u94C3\u6728
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Posting it again (Urgent!) Can't display chinese and japanese font at the same time