I have a binary file when open with HexEditor, it shows like this
00000130h: 00 00 00 00 00 06 29 B9 07 D9 04 17 42 53 43 36;
00000140h: 39 30 30 20 4D 52 00 00 00 00 00 00 00 00 00 00;
I got the following output: )¹ÙBSC6900 MR
I have tried with several coding attempt but still not getting the expected output.
I can get the last few characters "BSC6900 MR" but the infront characters are weird
Expand|Select|Wrap|Line Numbers
- string hexString = "0629B907D9041742534336393030204D52";
- byte[] tmp;
- int j = 0;
- tmp = new byte[(hexString.Length)/2];
- for (int i = 0; i <= hexString.Length - 2; i += 2)
- {
- tmp[j] =(byte)Convert.ToChar(Int32.Parse(hexString.Substring(i, 2), System.Globalization.NumberStyles.HexNumber));
- j++;
- }
- return Encoding.GetEncoding(1252).GetString(tmp);
Please advise. Thanks in advance :)