[pro] write-char vs. 8-bit bytes

Hans Hübner hans.huebner at gmail.com
Thu Apr 10 15:12:39 UTC 2014


Paul,

you need to use a stream with :element-type '(unsigned-type 8) if you want
to control the binary encoding.  If you need to mix binary and text, maybe
FLEXI-STREAMS (http://weitz.de/flexi-streams/) is helpful.

-Hans


2014-04-10 10:31 GMT-04:00 Paul Tarvydas <paultarvydas at gmail.com>:

> I'm using sbcl to write-char a 16-bit unsigned integer to a socket as two
> separate unsigned 8-bit bytes, for example 141 should appear as
>
> #x00 #x8d.
>
> SBCL appears to convert the #x8d into a two-byte utf-8 char, resulting in
> 3 bytes written to the stream
>
> \#x00 #xcd #x8d.
>
> What is the proper incantation to achieve this?  (SBCL on Windows, if that
> matters).
>
> thanks
> pt
>
>
> _______________________________________________
> pro mailing list
> pro at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/pro
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20140410/9b6ec196/attachment.html>


More information about the pro mailing list