From: Christopher R. Barry
Subject: Re: Reading characters and bytes from the same stream
Date: 
Message-ID: <87r9e7n5lf.fsf@2xtreme.net>
ยทยทยท@jpl.nasa.gov (Erann Gat) writes:

> Common Lisp distinguishes between characters and bytes, which is a
> Good Thing.  Unfortunately, the rest of the world doesn't, which leaves
> us with no choice but to deal with blurred boundaries (or shut ourselves
> off from reality).
> 
> I am trying to read data from an http stream.  Some of this data is
> ascii and some of it is binary.  Is there a better way to deal with
> this than constantly calling code-char or char-code?

If you use Allegro CL, be sure to read the documentation on bivalent
streams:

<allegro-dir>/doc/cl/socket.htm#2.0 Characteristics


     "Starting in release 5.0.1, the bivalent format is accepted for
     stream sockets. Bivalent means that the stream will accept text
     and binary stream functions. That is, you can write-byte or
     write-char, read-byte or read-char. A bivalent stream is useful
     in the http protocol (used between web browsers and web servers)
     since in that protocol the header data is sent in text format and
     the body can been binary data (image files, for example)."