title: Single Byte Character Codes
body: <p>I'm trying to implement a compression algorithm and for it I need to have an array of single byte character codes - they must be single byte. I'm unfamiliar with how to deal with character codes in programming but the requirements are they should be single byte and also not OS/machine dependent. Is it as easy as being the integer values 0 to 255? </p>
  
  <p>I used the following little snippet to see what characters are available to me if that is the case:</p>
  
  <pre><code>for (int i = 0; i &lt; 256; i++) {
      std::cout &lt;&lt; (char)i &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>It seems many of the first numbers are blank characters unseen and the last set are all displayed as ?</p>
  
  <p>EDIT:</p>
  
  <p>More specifically I'm trying to implement a similar algorithm to this <a href="http://www.csjournals.com/IJITKM/PDF%203-1/42.pdf" rel="nofollow">paper</a>. It chops up a DNA sequence into segments of 4, and converts them using a hash table, so for example AAAA converts to character encoded by a single byte character, AAAT is converted to a single byte character. For DNA a 4 byte in 1 byte is pretty good compression (although if I want to extend the alphabet from A, T, C, G to A, T, C, G, N, and - I would need 6^4 characters instead of the 256 needed for the 4 letter alphabet. I could reduce the compression from 4 in 1 to 3 in one and only need 216 single byte character codes.</p>
  
  <p>This compression is part of something I'm trying to write that should read in sequences from a multiple sequence alignments (sequences/strings of the 6 letter alphabet A, T, C, G, N and -) which may be very very large. And remove everything uninformative for my analysis program. I plan to do this by compressing the sequence as much as possible, then finding the uninformative stuff in the compressed representation, and then expanding the remaining stuff and then do a second sweep and get rid of the remaining uninformative stuff in the uncompressed representation, before compressing the remaining informative stuff again in prep for the analysis program.</p>
  
  <p>Perhaps there are better schemes than a hash scheme, I've heard of something called a reference based scheme I need to read up about. I've also thought that maybe once the DNA string has been compressed to the 256 single byte format, can this be further compressed with methods used to compress regular text?</p>