dcsimg
J2me display unicode
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ling_pin
Posted On:   Thursday, January 27, 2005 01:45 AM

I have a problem displaying unicode in my mobile (Sony ericson S700) but i have no problem displaying in Emulator. Everything work fine in emulator. I am trying to display a chinese character. The phone can display STATIC unicode characters properly if i hardcoded it. Eg. "u7d50u675f" (This work fine) But when I retrieve the information from text file. It just cannot work on phone. I have a file name as unicode.txt. Unicode.txt was saved in Unicode encoding. Below is my code: String s1 = "/unicode.txt"; InputStream in = getClass().getResourceAsStream(s1); InputStreamReader isr   More>>

I have a problem displaying unicode in my mobile (Sony ericson S700) but
i have no problem displaying in Emulator. Everything work fine in emulator. I am trying to display a chinese character.


The phone can display STATIC unicode characters properly if i hardcoded it.
Eg. "u7d50u675f" (This work fine)




But when I retrieve the information from text file. It just cannot work on phone.
I have a file name as unicode.txt. Unicode.txt was saved in Unicode encoding.




Below is my code:




String s1 = "/unicode.txt";



InputStream in = getClass().getResourceAsStream(s1);



InputStreamReader isr = new InputStreamReader(in, "UTF-16LE");



buffer = new StringBuffer();



int ch;



while ( (ch = isr.read()) > -1)



{



buffer.append( (char) ch);



}



if (isr != null)



isr.close();



return buffer.toString();



Beside unicode, i also had tried to save the file as UTF-8 encoding. And read it this way:



InputStreamReader isr = new InputStreamReader(in, "UTF8");



But it still cant work on phone but work fine on emulator.



Please kindly share your knowledge on this problem.



Thanks.

   <<Less
About | Sitemap | Contact