Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!rickert From: rickert@mp.cs.niu.edu (Neil Rickert) Newsgroups: comp.compression Subject: Re: How to code to a text file. Keywords: text file arithmetic coding hard coded wired range printable characters Message-ID: <1991Mar23.132656.32451@mp.cs.niu.edu> Date: 23 Mar 91 13:26:56 GMT References: <550@spam.ua.oz> Organization: Northern Illinois University Lines: 31 In article <550@spam.ua.oz> ross@spam.ua.oz.au (Ross Williams) writes: > >(Abstract: This short article describes a simple way to code a stream >of random bits into a stream of text characters.) > I think you would do better with Huffman coding. Or, more precisely, with Huffman decoding. Take your 94 printable characters (any other number of characters will work). Determine a fixed Huffman encoding for data that uses these characters uniformly. Announce the encoding. To encode a bit stream, do the appropriate Huffman decoding, resulting in a byte stream using these 94 characters. To reproduce the bit stream, do the Huffman encoding. The nice part is that it allows bit streams to be transparently sent from an ASCII site to an EBCDIC site. The Huffman table at each site reflect the character set actually used. (Of course use only characters for which the ASCII to EBCDIC conversion is universally agreed to). Some care is probably needed to add padding bits if needbe, and remove them on reconstruction of the bitstream, but a leading bit count could handle this. Of course, this method only works if the Huffman table to be used is agreed to by sender and receiver. -- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Neil W. Rickert, Computer Science Northern Illinois Univ. DeKalb, IL 60115 +1-815-753-6940