Results 1 to 3 of 3

Thread: [RESOLVED] Hex conversion problem...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2005
    Posts
    150

    [RESOLVED] Hex conversion problem...

    Hi I need to convert a hex string in UTF-16 to a hex string in UTF-8

    i.e
    String input ="0x0630"; //ARABIC LETTER THAL

    I want the output to be a hex representation of the same charcter in UTF-8.

    Does anyone know the java code to do this?
    Last edited by eakin; Jun 1st, 2010 at 09:30 AM.

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Hex conversion problem...

    Try this, I have no idea if it's the correct result
    Code:
    final Character c = Character.valueOf((char) (Integer.parseInt("630", 16)));
    System.out.println(Integer.toString(Charset.forName("utf-8").newEncoder().encode(CharBuffer.wrap(new char[] { c })).getChar(), 16));
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2005
    Posts
    150

    Re: Hex conversion problem...

    Exactly what I was looking for!
    Thanks for your help!

Posting Permissions

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



Click Here to Expand Forum to Full Width