W woodpecker Member Licensed User Longtime User Oct 2, 2011 #1 Hi folks, I am decoding serial data encoded in windows-1252 but it has some odd characters that need converting to plain text, with some of the chracters I am struggleing to identify them so I can replace them. I decided to try and do a byte conversion so I could look them up, however it is returning negative numbers for the characters I cannot identify. I am doing the following:- Code: Copy Dim data() as Byte data = mystring.GetBytes("WINDOWS-1252") For x = 1 To data.Length - 1 mybytes = mybytes & data(x) & CRLF Next panel2text.text = mybytes & CRLF Using this code spaces show as 32 which seems correct but other characters I am trying to identify show as -124 and -125 How do I find the char code so I can replace them?
Hi folks, I am decoding serial data encoded in windows-1252 but it has some odd characters that need converting to plain text, with some of the chracters I am struggleing to identify them so I can replace them. I decided to try and do a byte conversion so I could look them up, however it is returning negative numbers for the characters I cannot identify. I am doing the following:- Code: Copy Dim data() as Byte data = mystring.GetBytes("WINDOWS-1252") For x = 1 To data.Length - 1 mybytes = mybytes & data(x) & CRLF Next panel2text.text = mybytes & CRLF Using this code spaces show as 32 which seems correct but other characters I am trying to identify show as -124 and -125 How do I find the char code so I can replace them?
agraham Expert Licensed User Longtime User Oct 2, 2011 #2 Bytes are signed values in Java. See how to convert them. Upvote 0
W wdegler Active Member Licensed User Longtime User Oct 3, 2011 #3 Byte range A byte is a signed value stored in a single byte which has a binary value in the range 0 to 255.. Therefore, a value in this range greater than 127 will have the highest bit set which flags the number as negative. Upvote 0
Byte range A byte is a signed value stored in a single byte which has a binary value in the range 0 to 255.. Therefore, a value in this range greater than 127 will have the highest bit set which flags the number as negative.