TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Samuele Rossi
NA
5
829
Problem converting HEX string to ASCII
Sep 24 2014 4:02 AM
Hi all, i have this string in HEX: 00024944554E49563130434800A0 and need to convert in ASCII.
I have tried to use the following solution, but the encoding of the last parte of the string is incorrect "00A0" after the conversion in ASCII (and converted again to be sure of the date transmitted) became "003F", probably is an Encode problem, but i dont know how and where use it with success.
public static string HextoAscii(string HexString)
{
string asciiString = "";
for (int i = 0; i < HexString.Length; i += 2)
{
if (HexString.Length >= i + 2)
{
String hs = HexString.Substring(i, 2);
asciiString = asciiString + System.Convert.ToChar(System.Convert.ToUInt32(HexString.Substring(i, 2), 16)).ToString();
}
}
return asciiString;
}
Thank you very much for your help :)
Reply
Answers (
4
)
why are required property in C#
finding a key in any deserialized json class