• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
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


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

[ November 01, 2005: Message edited by: S Dan ]
[ November 03, 2005: Message edited by: S Dan ]
reply
    Bookmark Topic Watch Topic
  • New Topic