Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7838019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:57:10+00:00 2026-06-02T14:57:10+00:00

Possible Duplicate: Convert a string representation of a hex dump to a byte array

  • 0

Possible Duplicate:
Convert a string representation of a hex dump to a byte array using Java?

For example I get an octet string as follow:
3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e3c53
6f6170456e763a456e76656c6f706520786d6c6e733a536f6170456e763d22687474703a2f2f7363
68656d61732e786d6c736f61702e6f72672f736f61702f656e76656c6f70652f223e3c536f617045
6e763a48656164657220786d6c6e733a7773613d22687474703a2f2f7777772e77332e6f72672f32
3030352f30382f61646472657373696e67223e3c7773613a46726f6d3e3c7773613a416464726573
733e43484e594442473c2f7773613a416464726573733e3c2f7773613a46726f6d3e3c7773613a54
6f3e434352433c2f7773613a546f3e3c7773613a416374696f6e3e687474703a2f2f636372632e73
6572766963652e62616e6b636f6d6d2e636f6d2f6162737472616374696f6e2f61746f6d69632f74
6563686e6963616c2e506572736f6e616c4372656469745265706f7274536572762f4661756c743c
2f7773613a416374696f6e3e3c7773613a4d65737361676549443e75726e3a757569643a30303031

And I know the underlying text is UTF-8 encoding, so who can offer some methods to convert these octets to readable string?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T14:57:11+00:00Added an answer on June 2, 2026 at 2:57 pm

    Try reading each two characters, parsing them as a base 16 integer with Integer.parseInt(String,int), adding them to a byte array, and constructing a String from the result:

    public static String fromHex(String s) throws UnsupportedEncodingException {
      byte bs[] = new byte[s.length() / 2];
      for (int i=0; i<s.length(); i+=2) {
        bs[i/2] = (byte) Integer.parseInt(s.substring(i, i+2), 16);
      }
      return new String(bs, "UTF8");
    }
    
    fromHex("48656c6c6f2c20576f726c6421"); // => "Hello, World!"
    

    Your string example looks like an XML document containing a SOAP message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Convert a binary string representation to a byte array I have a
Possible Duplicate: How do you convert Byte Array to Hexadecimal String, and vice versa,
Possible Duplicate: convert string to 2D array using php I have the string like
Possible Duplicate: .NET String to byte Array C# How do I convert String to
Possible Duplicate: How do I convert hex string into signed integer? example:3A convert to
Possible Duplicate: Convert a long hex string in to int array with sscanf I
Possible Duplicate: How do you convert Byte Array to Hexadecimal String, and vice versa,
Possible Duplicate: Get first element of array Convert array to string php I have
Possible Duplicate: How to convert from int to string in objective c: example code…
Possible Duplicate: .NET Convert from string of Hex values into Unicode characters (Support different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.