Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Unicode in Java

  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unicode in Java

    Hi
    I have a String containing HEX values for example:
    String myString="F3DA";
    I would like to get the unicode that this HEX value represent.
    I tried to make
    Char ch='92'; // 92 in ASCII is "\"
    and then
    s=ch+"u"+myString;
    But when I am trying to System...print(s) I get
    myString="\\uF3DA"
    and I need that myString to contain "\uF3DA".
    Do you have any suggestions?
    Thank you very much.

  • #2
    rix
    rix is offline
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    why don't you just use the escape character for "\" that trying to do it with parsing a string ?

    now just from your example, this is what i came up with - hope it works like u wanted it to.


    String myString="F3DA";
    String s= "\\u"+myString;
    System.out.println("myString: " + myString + "; s: " + s);

    that \\ is the escape character in java for the \

    then you get \n - new line
    \t - tab
    and so forth
    anyways
    good luck


  •  

    Posting Permissions

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