File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying Foreign Languages

 
Danish Shaukat
Ranch Hand
Posts: 340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
[ October 08, 2004: Message edited by: Danish Shaukat ]
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1953
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic