• Post Reply Bookmark Topic Watch Topic
  • New Topic

read japanese string from resorce file  RSS feed

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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;
in = getClass().getResourceAsStream(str);
size = in.read(work);
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
Boost this thread!