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 6961303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:30:48+00:00 2026-05-27T15:30:48+00:00

I have a string of Hex values… String hexString = 8A65; I need to

  • 0

I have a string of Hex values…

String hexString = "8A65";

I need to convert this string into their Unicode equivalents. The tricky part is that I need to support different code pages and some code pages have ‘8A65’ = one character whereas other code pages would convert it into two characters.

I have no prior knowledge of which code page I will be using until I need to perform the conversion.

I’ve tried all sorts of stuff such as

byte[] original = Encoding.Unicode.GetBytes(hexString);
byte[] conv= Encoding.Convert(Encoding.Unicode, Encoding.GetEncoding(932), orig);
char[] chars = Encoding.GetEncoding(932).GetChars(conv);

Note: code page 932 is Japanese

SOLUTION

string hexString = "8A65";
int length = hexString.length;
byte[] bytes = new byte[length / 2];

for (int i = 0; i < length; i += 2)
{
    bytes[i / 2] = Convert.ToByte(hexString.Substring(i, 2), 16);
}

char[] chars = Encoding.GetEncoding(932).GetChars(bytes);

Thank you pstrjds, you are a life saver!

  • 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-05-27T15:30:48+00:00Added an answer on May 27, 2026 at 3:30 pm

    You need to convert the hex string to bytes (see SO post). Passing the hex string into one of the encodings to convert it to bytes just gives you the byte equivalent of those characters. I am assuming what you want is the two bytes that the 4 character string represents, so decode the hex to bytes and then you can use the encoding on the decoded bytes to get back a string.

    Encoding.{YourEncoding}.GetChars(hexBytes);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of string-encoded hex values. I need to convert those strings
I have a list of String representations of unicode hex values such as 0x20000
Let's say that I have a string 5a . This is the hex representation
How would I copy/convert a string containing an ascii representation of hex values in
I need to convert ascii to hex values. Refer to the Ascii table but
I have a long long holding ASCII hex values and want to convert it
I have a string 'RAJA' which should be written into a file as HEX
I Wrote a small php script to convert string to HEX but i have
I'm having some trouble to Convert UNICODE to HEX values.. I couldn't find proper
So i have a string x = 10101 and i need to put into

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.