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 :)