×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    58

    Chinese file encoding.

    Hi everyone. Sorry I do not speak chinese

    I am porting our applications to chinese and I have a question. I am loading all the text from a file. Much like a resource bundle.

    I have one file for Simplified Chinese one for Traditional and one for English. With properties like:

    game=gameInChinese
    options=optionsInChinese

    Now I load the file as follows:
    InputStreamReader myReader = new InputStreamReader( aStream, "unicode");

    Is this the correct encoding to load the file? I have saved the file as a text document with Microsoft Note pad using unicode encoding. It does seem to work but it seems incorrect to me. In addition none of the emulator I run (none chinese) seem to allow for this encoding.

    Thank you

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    537
    Hi,

    If you want to load Chinese resource file, the file encoding should be UTF-8.

    For example:

    ...
    DataInputStream dis = new DataInputStream(this.getClass().getResourceAsStream("/Hello.txt"));

    byte[] bs = new byte[11];
    dis.read(bs);
    dis.close();

    //Use only "UTF-8" parameter with Nokia 7210/3510i emulator, Sun WTK 2.0 emulators also accept "UTF8" and "UTF_8".
    String temp = new String(bs,"UTF-8");
    ...

    Green Lu

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    58

    Thanks

    Excellent thank you that is exactly what I needed !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×