×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Dec 2008
    Location
    Kazakhstan, Almaty
    Posts
    17

    Question Using utf-8 text files in project

    I need multi language support in my app.
    so I found this way will be good:
    messages that will be shown to user will be stored in utf-8 text file.
    in my app I will load some of them to memory and I will use their _numericValue_ (getNumberValue?) to draw letters using custom font (sprites).

    but there is problem : 1. WTK 2.5 dont like UTF-8 source files, so I cant check Character.getNumeric Value.
    will it work if I will load file to String var and then will work with each char of that string var?

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Using utf-8 text files in project

    Check the wiki for How to create localized text resources.

    Graham.

  3. #3
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    75

    Re: Using utf-8 text files in project

    Hi,

    Yes, you should store messages in files (outside your program). Yes, you should use utf-8 encoding.

    If you want to display almost any alphabetic languages (languages that are NOT Chinese, Japanese, Korean, etc.) then you display the utf-8 encoded Strings as you would in English. Most every phone has the necessary hardware and firmware to display all Western languages, and also most every language that uses an alphabet (Vietnamese, Indonesian, a variety of Indian languages, etc.). You do NOT need to use custom fonts.

    I don't use WTK, so I don't know what it likes (or doesn't). I use NetBeans and create my language files using OpenOffice which is happy to store text in utf-8 format.

    Cheers,
    Matt Brenner
    UnME2, Inc.

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Using utf-8 text files in project

    Specify UTF-8 when you open the file (eg, through InputStreamReader), and then read Strings. Conversion from UTF-8 to UTF-16 (Unicode) will be automatic. All of the String and Character methods will work normally.

Similar Threads

  1. UTF-8 text editor for E71
    By nonozor in forum General Messaging
    Replies: 1
    Last Post: 2010-02-21, 17:29
  2. any experience on j2mepolish preprocessing of UTF-8 source files?
    By jerrytian in forum Mobile Java General
    Replies: 1
    Last Post: 2009-07-25, 11:52
  3. Saving files in UTF-8 problem
    By Sara Ali in forum Symbian User Interface
    Replies: 1
    Last Post: 2009-04-25, 10:22
  4. reading utf-8 files
    By Christophe.A in forum Symbian
    Replies: 6
    Last Post: 2008-07-11, 07:49
  5. Reading UTF-8 text file
    By rikard_wigforss@hotmail.com in forum Mobile Java General
    Replies: 2
    Last Post: 2003-05-22, 06:05

Posting Permissions

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