How do I convert from 8 bit byte to 7 bit byte (Base 256 to Base 128)
I am looking to do something like this:
public string BytesToString(byte[] in)
{
}
Base64 encodes 6 bits per character, producing a string which can be reliably transmitted with very little effort (modulo being careful about URLs).
There is no 7-bit alphabet with the same properties - many, many systems will fail if they're given control characters, for example.
Are you absolutely sure that you're not going to need to go through any such systems (including for storage)? It the extra tiny bit of space saving really enough to justify having to worry about whether something's going to change "\n" to "\r\n" or vice versa, or drop character 0?
(For a storage example, 2100 bytes = 2800 chars in base64, or 2400 chars in base128. Not a massive difference IMO.)
I'd strongly urge you to see whether you can find the extra storage space - it's likely to save a lot of headaches later.