I have a binary array. In the process of conversion it into string,due to some data my string gets terminated. and it ignores next data.Have a look on my code. Is there is any mistake??
str += (char)chunkData[index].ToString();
Later on i want to display it on textbox.
My array contains following data as display in hex editor.
xÚb```e``*bxÚb`
¨€ˆY8ÄX¡˜A‰“yuZs˜#µjтЬi@š
È4„è0
I tried this but nothing change..
str = System.Text.Encoding.ASCII.GetString(chunkData);
You shouldn’t use text to represent arbitrary binary data. You will almost certainly lose data if you just use Encoding.GetString and Encoding.GetBytes.
If you really want to convert arbitrary binary data to text and back, use
Convert.ToBase64StringandConvert.FromBase64String.As for ‘\0’ termination: .NET strings themselves don’t rely on termination characters, but many UI controls (including
TextBox) will treat ‘\0’ as a termination character.