Unicode String Literals

Discussion in 'Java' started by didster@gmail.com, Nov 21, 2005.

  1. Guest

    Hi all,

    I am trying to convert an app we have to french. We have all the
    strings translated, and I am trying to get things working.

    The problem we are having is we have the strings in "real" format, such
    as :

    "Entrée d'agenda"

    This, is put in code as:

    public static final String Run_Diary = "Entrée d'agenda";

    When running, the string is mangled and the é is replaced by A@. I
    know you can do this:

    public static final String Run_Diary = "Entr\u00E9e d'agenda";

    And that works, but is there a way to specify the literal string
    without escaping it?

    Thanks
     
    , Nov 21, 2005
    #1
    1. Advertising

  2. On 21.11.2005 12:01 wrote:
    > Hi all,
    >
    > I am trying to convert an app we have to french. We have all the
    > strings translated, and I am trying to get things working.
    >
    > The problem we are having is we have the strings in "real" format, such
    > as :
    >
    > "Entrée d'agenda"
    >
    > This, is put in code as:
    >
    > public static final String Run_Diary = "Entrée d'agenda";
    >
    > When running, the string is mangled and the é is replaced by A@. I
    > know you can do this:
    >
    > public static final String Run_Diary = "Entr\u00E9e d'agenda";
    >
    > And that works, but is there a way to specify the literal string
    > without escaping it?
    >
    > Thanks
    >


    There is a tool as part of the JDK which does this for you:

    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/native2ascii.html

    Thomas
     
    Thomas Kellerer, Nov 21, 2005
    #2
    1. Advertising

  3. Guest

    Thanks very much!

    I have been messing around with the encoding options in netbeans, which
    are suppose to do it (so some people claim) and can't get that to work,
    so I will try this
     
    , Nov 21, 2005
    #3
  4. Roedy Green Guest

    Roedy Green, Nov 21, 2005
    #4
  5. Roedy Green Guest

    Roedy Green, Nov 21, 2005
    #5
    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. John Goche
    Replies:
    8
    Views:
    16,473
  2. nico
    Replies:
    6
    Views:
    787
  3. Richie Hindle

    Making all string literals Unicode

    Richie Hindle, May 15, 2006, in forum: Python
    Replies:
    0
    Views:
    302
    Richie Hindle
    May 15, 2006
  4. Fletcher Johnson
    Replies:
    4
    Views:
    335
    Fletcher Johnson
    Nov 1, 2011
  5. jmfauth
    Replies:
    2
    Views:
    203
    jmfauth
    Feb 29, 2012
Loading...

Share This Page