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