aspose file tools*
The moose likes Java Micro Edition and the fly likes Displaying Foreign Languages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Displaying Foreign Languages" Watch "Displaying Foreign Languages" New topic
Author

Displaying Foreign Languages

Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Hi all,

I want to display text in Chinese on my phone. The phone does support Chinese.

I know that I'll have to read text from a file(prolly a text file) that is in UTF8 format.

Do I have to save text in Chinese in this text file or do I have to convert it in to raw unicode (\u0XXX) and then save it to the UTF8 encoded text file.

If I save it as Chinese in UTF8 format, then it appears as small boxes.

Danish
Xua Hsin Lin
Greenhorn

Joined: Oct 07, 2004
Posts: 4
If you save Chinese words in file.
You don't need to convert it to UTF-8.
Just like- String tmp = new String("大家好");
os.write(tmp.getBytes());
P.S os is OutputStream object

If you read some string from a chinese file
byte[] text = new byte[10];
is.read(text); //is is InputStream
String outtext = new String(text,"Big5");
// You need to new a String using Big5 Encoding
System.out.println(outtext);
[ October 08, 2004: Message edited by: Xua Hsin Lin ]
Danish Shaukat
Ranch Hand

Joined: Nov 16, 1999
Posts: 340
Thanks.
[ October 08, 2004: Message edited by: Danish Shaukat ]
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Originally posted by Xua Hsin Lin:
.........
// You need to new a String using Big5 Encoding
...........


Not necessarily, you can use UTF8, BIG5, GB2312, or even straight unicode. It depends on your needs and what you phone supports.

Unicode will always work, as long as the phone has those fonts installed, even Arabic as well as Chinese at the same time! That is what I use.
[ October 08, 2004: Message edited by: Roseanne Zhang ]
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
The problem of using unicode is the file is not human-eye readable, unless you do something on it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying Foreign Languages