Re-encoding characters is generally done when the receiving system can't process them. For example, BASE64 is representing data using 6 bits (26, hence 64) of characters to represent longer data sequences (the sometimes-appearing "==" at the end is padding for alignment). This is because your picture file in email may have 0xFE in it and your mail server will be unhappy transmitting that (or any other traditionally non-printing character).
There is no encoding that "reduces size." Encodings are just mappings of bits to the character they represent. That said, ASCII is a 7 bit character set (encoding) that is often stored in 8 bits of space. If you limit the ranges that you accept, you can also weed out the control characters.
Using this method means you have to write things out at the bit level, and it also plays a bit of hell with machine speed & instructions because all modern machines have alignments that are multiples of 8 bits. That, for example, is why Unicode is UTF-8, UTF-16, and UTF-32.
If you're doing this for security (that's why you posted it on Security.SE, right?), just filter things out and store them normally. If you're doing this to save space, consider whether all the extra code and slower access time (because most entries will cross address boundaries) is worth the space savings.
By the by, the following is a snippet from a CS course where we had to convert ASCII from 8 bit storage to 7 bit:
memset(dest,0x00,8);
memcpy(dest, source, length);
for (int i = 0; i < 8; i++) {
if (dest[i] & 0x80) {
fprintf(stderr, "%s: %s\n", dest, "Illegal byte sequence");
exit(EILSEQ);
}
}
dest[0] = 0x7F & dest[0] | 0x80 & dest[1] << 7;
dest[1] = 0x3F & dest[1] >> 1 | 0xC0 & dest[2] << 6;
dest[2] = 0x1F & dest[2] >> 2 | 0xE0 & dest[3] << 5;
dest[3] = 0x0F & dest[3] >> 3 | 0xF0 & dest[4] << 4;
dest[4] = 0x07 & dest[4] >> 4 | 0xF8 & dest[5] << 3;
dest[5] = 0x03 & dest[5] >> 5 | 0xFC & dest[6] << 2;
dest[6] = 0x01 & dest[6] >> 6 | 0xFE & dest[7] << 1;
dest[7] = 0x00; //Clearing out