This discussion is archived
12 Replies Latest reply: Nov 18, 2012 4:05 AM by 814889 RSS

hexdeciam char     java unicode

814889 Newbie
Currently Being Moderated
HI I have some hexdecimal char i want to convert it to java unicode can anybody help me do this.

\u901A\u8FC7\u7535\u5B50\u90AE\u4EF6\u63A5\u6536\u901A\u77E5


when we convert this should actula be chinese char

i know there are some sties that do it online, i want code to do it
  • 1. Re: hexdeciam char     java unicode
    gimbal2 Guru
    Currently Being Moderated
    Are you talking about that string you posted? Because that's actually a unicode char sequence. If you have that as actual string data it may be a bit of a challenge to convert that back to unicode characters. This stackoverflow thread deals with the topic:

    http://stackoverflow.com/questions/4997325/java-how-to-create-unicode-from-string-u00c3-etc
  • 2. Re: hexdeciam char     java unicode
    sabre150 Expert
    Currently Being Moderated
    I have published this several times before :-
        // For Rewriter see http://elliotth.blogspot.com/2004/07/java-implementation-of-rubys-gsub.html
            String title = "\\u901A\\u8FC7\\u7535\\u5B50\\u90AE\\u4EF6\\u63A5\\u6536\\u901A\\u77E5";
            Rewriter rewriter = new Rewriter("\\\\u([0-9A-Fa-f]{4})")
            {
                @Override
                public String replacement()
                {
                    return Character.toString((char) Integer.parseInt(group(1), 16));
                }
            };
            title = rewriter.rewrite(title);
            System.out.println(title);
    It gives
    通过电子邮件接收通知

    Edited by: sabre150 on Nov 15, 2012 2:51 PM
  • 3. Re: hexdeciam char     java unicode
    gimbal2 Guru
    Currently Being Moderated
    Neat!
  • 4. Re: hexdeciam char     java unicode
    sabre150 Expert
    Currently Being Moderated
    gimbal2 wrote:
    Neat!
    But seemingly unappreciated by Vicky since there is absolutely no feedback from him/her.
  • 5. Re: hexdeciam char     java unicode
    rukbat Guru Moderator
    Currently Being Moderated
    Nope, and it seems they'll never return to give any feedback:
    Vicky           Newbie
    Handle:      Vicky
    Status Level:      Newbie
    Registered:      Nov 16, 2010
    Total Posts:      95
    Total Questions:      45 *(40 unresolved)*
  • 6. Re: hexdeciam char     java unicode
    gimbal2 Guru
    Currently Being Moderated
    Yeah I noticed that too. You'd think that people would do at least the very minimal bit of effort to keep others in a frame of mind that they want to help you. But I'm silly like that.
  • 7. Re: hexdeciam char     java unicode
    sabre150 Expert
    Currently Being Moderated
    gimbal2 wrote:
    Yeah I noticed that too. You'd think that people would do at least the very minimal bit of effort to keep others in a frame of mind that they want to help you. But I'm silly like that.
    Vicky's handle is very memorable. If Vicky had one of the fairly anonymous numeric handles then I would not remember to ignore him/her in the future.
  • 8. Re: hexdeciam char     java unicode
    gimbal2 Guru
    Currently Being Moderated
    sabre150 wrote:
    gimbal2 wrote:
    Yeah I noticed that too. You'd think that people would do at least the very minimal bit of effort to keep others in a frame of mind that they want to help you. But I'm silly like that.
    Vicky's handle is very memorable. If Vicky had one of the fairly anonymous numeric handles then I would not remember to ignore him/her in the future.
    I was just speaking hypothetically - I couldn't care one way or the other how much consideration someone shows myself, just as long as you don't start mouthing off. Its a free internets after all. But I do know that there are plenty of people who thrive on proper form, so its not too clever to go down the path of treating the forum like your personal answering service.
  • 9. Re: hexdeciam char     java unicode
    814889 Newbie
    Currently Being Moderated
    I am extermely sorry for not giving any feedback on answere that i got , you people on oracle forum have been life saver too me and my gurus , i learnt lot from u people then txt books from now on i will strictly give feedback on responses, i wil go to my old threads and give responses too.
  • 10. Re: hexdeciam char     java unicode
    814889 Newbie
    Currently Being Moderated
    I still have one question i know that hexdecimal is converted to java unicode through code can anybody let me know
    what is the logic or algorithm behind it i mean we can convert same hexadecimal code html chars too please help
  • 11. Re: hexdeciam char     java unicode
    sabre150 Expert
    Currently Being Moderated
    Vicky wrote:
    I still have one question i know that hexdecimal is converted to java unicode through code can anybody let me know
    what is the logic or algorithm behind it i mean we can convert same hexadecimal code html chars too please help
    WTF ! Did you not read my first response!
  • 12. Re: hexdeciam char     java unicode
    814889 Newbie
    Currently Being Moderated
    WTF!


    I can use more words i intent not to , Sabre your post says lot of code but not about logic behind but how actually hexdecimal is converted to java unicode

    My question what does msToIsoString do iknow method says something but i want to know what actually is happening

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points