• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Displaying Foreign Languages

 
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
[ October 08, 2004: Message edited by: Danish Shaukat ]
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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'm not sure if I approve of this interruption. But this tiny ad checks out:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic