> 2007/5/15, Ball, Donald A Jr (Library) <donald.ball / nashville.gov>: > <snip> > > I also tried writing a binary encoder which packs and > unpacks the bit > > strings generated by my string encoder, but it fails to > decompress the > > entire text for long files, e.g. the program source code > itself. I'm > > unsure why, perhaps someone more experienced in this arena > can suggest > > why. > > Perhaps because the file you want to encode already contains > your end-marker. The decoder stops when it encounters the > first end-marker (line 161). A binary file would not be > unlikely to contain a NULL character somewhere. That was my first thought, but I threw in a check for the existence of NULL characters in the frequency hash before merging the EOS=>0 hash, and it did not complain. Besides, the file I'm trying to decompress is the ruby source of my quiz solution, which is just plain ol' text. - donald