dcsimg
Displaying Chinese characters in Swing
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, June 25, 2002 02:10 AM

Using Property file i am able to display the chinese characters using Resource Bundle. I am converting this to numeric character expression like "乀乊" and storing as string in the database. Again to display the result i am converting the string from database to hex code format(u4e2d). But the string is displaying in the text box as it is, it is not converted to relevant font. For text fields locale is set to relevant language. Code snippet: //value of str is got from db String str="乀乊"; String hex=""; StringTokenizer st = new StringTokenizer(str,";"); while(st.hasMoreTokens()) { str=st.nextToken().substring(2);    More>>


Using Property file i am able to display the chinese characters using Resource Bundle. I am converting this to numeric character expression like "乀乊" and storing as string in the database. Again to display the result i am converting the string from database to hex code format(u4e2d). But the string is displaying in the text box as it is, it is not converted to relevant font.

For text fields locale is set to relevant language.

Code snippet:
//value of str is got from db
String str="乀乊";
String hex="";
StringTokenizer st = new StringTokenizer(str,";");
while(st.hasMoreTokens())
{
str=st.nextToken().substring(2);
hex+="\u" + Integer.toHexString(Integer.valueOf(str).intValue());

}
text1.setText(hex);


Sample Property File
name=u4e2du3002

   <<Less
About | Sitemap | Contact