×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Character encoding

    Hi,
    I want to use Greek Font on the Canvas, and I send a String (in Greek) to the setText() method. But I get
    an EOFException . Here is the code:

    public void setText(String text) {
    try {
    byte[] gText = text.getBytes();
    ByteArrayInputStream bis = new ByteArrayInputStream(gText);
    DataInputStream dis = new DataInputStream(bis);
    int i = gText.length;
    while (i != -1) {
    // I get here the EOFException
    System.out.println(dis.readUTF());
    }
    bis.close();
    dis.close();
    }
    catch(EOFException ex) {
    db("CIProduct EOFException " + ex.toString());
    }
    catch(UnsupportedEncodingException ueex) {
    db("CIProduct UnsupportedEncodingException " + ueex.toString());
    }
    catch(IOException ioe) {
    db("CIProduct IOException " + ioe.toString());
    }
    }

    How can I use readUTF() to display the Greek fonts on the canvas?
    Can anyone help me?

    Thanx...

  2. #2
    Registered User
    Join Date
    Jul 2003
    Location
    Finland, Tampere
    Posts
    1,113
    Have you tried just drawString() with our greek texts?
    If your String is already in Unicode, then there is no need to convert it somehow. If it is not in Unicode, then conversion should be performed in a different way.

    Sorry, if I didn't understand your question

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    7
    Yes, but it dont work's!

  4. #4
    Registered User
    Join Date
    Jul 2003
    Location
    Finland, Tampere
    Posts
    1,113
    What exactly doesn't work?
    Do you provide it with Greek Unicode string, but it is printed as some wrong characters?

    Are you sure, that your phone itself supports Greek? It might not have Greek font at all.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    7
    Ok, it works fine when I switch the device language from Greek to English. I thing this is a bug.

  6. #6
    Registered User
    Join Date
    Apr 2004
    Posts
    7

    Character Encoding

    Hi everybody,

    I have a similar question related to character encoding also.

    As I learn from the Nokia device document that all Nokia devices support at least UTF-8, does it mean that all characters, which include English characters & traditional or simple Chinese characters, in such format can be displayed in all Nokia devices properly?

    Meanwhile, can such characters in UTF-8 encoding system be displayed properly in the KToolBar, the J2ME development kit from Sun?

    Thank you.

Posting Permissions

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