This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

read japanese string from resorce file

 
merabi kamjin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.

i'm currently working on japanese app and hav some probz.
i'm tryin to read japanese font from a file (in res folder) and display them w/ drawString, but i cannot display them correctly...

When i run the app on the emulator, it's displaying the fonts but when i install the app into nokia phone it displays rectangles and other wired junks...

currently, i'm using following method to read japanese string:

public String readRes(String str){
byte[] work = new byte[1000];
int size=0;
InputStream in = null;
try{
in = getClass().getResourceAsStream(str);
size = in.read(work);
in.close();
return new String(work, 0, size);
}
.....
}

when i use above method, i couldn' display the font on the phone (emulator was fine).
so i developed another method if it fixes the prob:

public String getAs(String src) throws Exception {
byte[] b = src.getBytes("SJIS");
String result = new String(b, "SJIS");
return result;
}

but it made it worse.
it's not displaying correctly either on the emulator or phone...

i'm not quite sure if this is the RIGHT place to ask this kinda question, but i know this is THE BEST place to ask question!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic