By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,778 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,778 IT Pros & Developers. It's quick & easy.

String not displayed properly.

P: n/a
Hello,
I am facing a weird problem while displaying my String in JFrame while
prototyping Hindi character display
To explain this a little bit.
I am pushing unicode characters into a Varchar2 field in the Database
and then trying to retrieve it at run time.

From the database, using JDBC, I obtain a String like
"\u0916\u093e\u0924\u093".
I pass this string to a Frame

class testText extends Frame
{
TextField t = null;
testText(String str)
{
try {
//System.out.println(str);
t = new TextField();
t.setLocale(new Locale("hi","IN"));
t.setFont(new Font("Naidunia",Font.PLAIN,14));
t.setText(str);
add(t);
this.setSize(400,400);
this.setVisible(true);
}catch(Exception e){
e.printStackTrace();
}
}
}

This code should print a Hindi text like
"खाता" in the TextField but what it prints is
""\u0916\u093e\u0924\u093".
Although, a code like
class testText extends Frame
{
TextField t = null;
testText(String str)
{
try {
//System.out.println(str);
t = new TextField();
t.setLocale(new Locale("hi","IN"));
t.setFont(new Font("Naidunia",Font.PLAIN,14));
//t.setText(str);
t.settext("\u0916\u093e\u0924\u093");
add(t);
this.setSize(400,400);
this.setVisible(true);
}catch(Exception e){
e.printStackTrace();
}
}
}
prints "खाता".
Pretty strange as it doesnt seem logical.
Please help me out with this
Thanks,
Gagan
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.