×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2004
    Posts
    5

    How to display chinese characters in the Nokia emulator and the actual phone unit

    Hello everyone!

    I'm having trouble displaying chinese characters on the Nokia 3300 SDK beta_05 emulator, and the actual phone unit itself.

    I was able to display the right characters, except that 2 BOXES appear in between 2 chinese characters... I used this code:

    public class TextReader {

    String str = "";

    public TextReader(String url) {
    StringBuffer buffer = new StringBuffer();
    try {
    InputStream is = this.getClass().getResourceAsStream(url);
    InputStreamReader isr = new InputStreamReader(is, "UTF8");
    int ch;
    while ((ch = isr.read()) > -1) {
    buffer.append((char)ch);
    }
    isr.close();
    str = buffer.toString();
    } catch (IOException e) {
    e.printStackTrace();
    }
    }

    public String getText() {
    return str;
    }
    }

    This code reads a file in "ANSI" format and displays the right chinese characters except for the fact that there appears 2 boxes in between characters.

    Can anybody advise me on what steps to take to eliminate this problem? Also the problem with the actual unit... where the application displays boxes, instead of the correct Chinese characters...

    Sorry, I do not understand Chinese... English replies are greatly appreciated. Thank you very much to all of you!

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    China
    Posts
    66
    Save your resource file using UTF-8 Coding, not ansi.

  3. #3
    Registered User
    Join Date
    Feb 2004
    Posts
    5
    it worked well for me! i saved my text file as ANSI and the program automatically converts it to utf-8 when I read it... Problem solved now. thanks anyway!

Posting Permissions

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