National letters in strings from ResourceBundle

Discussion in 'Java' started by Brzezi, Oct 24, 2004.

  1. Brzezi

    Brzezi Guest

    Hi.

    I`m writing program, in it I`m using strings received from .properties file
    by ResourceBoundle, end if I put this strings into components like JLabel,
    JButton, instead of national letters (in this case Polish letters) I see
    '?'

    I use NetBeans4.0 IDE, if I hardcode strings into source, everything is
    good, without i'?', .properties files I edit in NetBeans too,

    Do you have any idea how to solve it?


    Pozdrawiam
    Brzezi
    --
    [ E-mail: ][ GEEK CODE [Version: 3.12]: GCM dpu s+:- ]
    [ Ekg: #3781111 ][ a--- C+++ UL++ P+ L+++ E--- W+++ N+++ ]
    [ LinuxUser: #249916 ][ o-- K- w--- O-- M- V- PS PE Y PGP--- t+ ]
    [ 5- X++ R* tv+ b- DI- D+ G+ e- h! r y-- ]
    Brzezi, Oct 24, 2004
    #1
    1. Advertising

  2. Tor Iver Wilhelmsen, Oct 24, 2004
    #2
    1. Advertising

  3. Brzezi

    Oscar kind Guest

    Brzezi <> wrote:
    > I`m writing program, in it I`m using strings received from .properties file
    > by ResourceBoundle, end if I put this strings into components like JLabel,
    > JButton, instead of national letters (in this case Polish letters) I see
    > '?'


    This looks like character encoding problem.

    ResourceBundle is an abstract class, with two known subclasses. For a
    resource bundle read from a .properties file, PropertiesResourceBunble is
    used. The API for this class refers to ResourceBundle and Properties. It
    also makes a special note of mentioning charcater encodings at:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding

    A quote from that page:
    "This format uses the ISO 8859-1 character encoding. Characters that cannot
    be directly represented in this encoding can be written using Unicode
    escapes; only a single 'u' character is allowed in an escape sequence.
    The native2ascii tool can be used to convert property files to and from
    other character encodings."

    For more information on unicode escapes, see:
    http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#100850


    --
    Oscar Kind http://home.hccnet.nl/okind/
    Software Developer for contact information, see website

    PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
    Oscar kind, Oct 24, 2004
    #3
  4. Brzezi wrote:
    > Hi.
    >
    > I`m writing program, in it I`m using strings received from .properties file
    > by ResourceBoundle, end if I put this strings into components like JLabel,
    > JButton, instead of national letters (in this case Polish letters) I see
    > '?'


    (a) Only use ISO Latin 1 characters in the properties files
    (b) For other characters use the \u.... notation
    (c) To avoid having to type all the \u stuff manually, use the
    native2ascii tool that comes with the SDK and add it to your build system.

    /Thomas
    Thomas Weidenfeller, Oct 25, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. [MSFT]Allen
    Replies:
    0
    Views:
    411
    [MSFT]Allen
    Aug 7, 2003
  2. Vladimír Kolesnik

    read national characters from the form

    Vladimír Kolesnik, Oct 9, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    637
    Vladimír Kolesnik
    Oct 10, 2004
  3. Peter Hemmingsen

    National characters in response

    Peter Hemmingsen, Dec 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    371
    Peter Hemmingsen
    Dec 2, 2004
  4. Merrigan
    Replies:
    4
    Views:
    557
    Chris
    Dec 14, 2007
  5. Venugopal
    Replies:
    11
    Views:
    1,495
    Tassilo v. Parseval
    Nov 5, 2003
Loading...

Share This Page