Apologies if this has been answered somewhere, but if it has, I couldn't find it.
I am doing some manipulations with byte arrays, and have noticed that when converting invalid chars (for example, the byte 0x9C) , it gets interpreted as a "?". Therefore, when I convert it back into a byte, it comes out as 0x3F.
My issue is that parts of the byte arrays are ASCII, but others are checksums that may contain invalid chars like this one. I would like to be able to convert the entire array into a string for convenience. Is there an encoding that will yield ASCII for normal characters and ensure that converting an invalid char to a string and back will yield the same byte?