Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem in retrieving Chinese strings stored in Resource Bundle fiels

807606Mar 16 2007 — edited Mar 22 2007
Hello,

I have installed Chinese fonts on my m/c.
I have also added Chinese language in Regional and Language settings. I am able to print Chinese charecters thro' Sys.out.pr.
I am using Win XP.

I have reource bundle file containg :
greetings = ?������??��
farewell = ?������??��
inquiry = How are you?
Named MessageBundle_zh_CN.properties


Source code :

ResourceBundle messages;
Locale currentLocale = new Locale("zh", "CN");

messages = ResourceBundle.getBundle("MessagesBundle",
currentLocale);
try {
String greetings = new String(messages.getString ("greetings").getBytes("GB2312"));
System.out.println("gr :: " +greetings);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}

My problem is :

When I execute this program 1st of all it's not finding the required "MessageBundle_zh_CN.properties". It's taking values from base "MessageBundle.properties". And showing "??" for Chinese values.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2007
Added on Mar 16 2007
10 comments
683 views