I originally wrote:
DL> I'm running ACL/Win version 3.0. I want to send a CR (carraige-return
DL> ascii code 13) to a socket. How do I create a character in lisp that
DL> corresponds to carraige return?
DL> I tried the following:
DL> (format hifsock "~A" #\return)
DL> and
DL> (format hifsock "~A" #\newline)
DL> and they both emit ascii code 10 for linefeed, In fact,
DL> #\return
DL> or
DL> #\newline
DL> both return
DL> #\Newline
DL> I also tried
DL> (code-char 13)
DL> which returns NIL
It turns out that the problem has to do with the fact that I was using
a socket. Under ACL/Win the make-socket call has an extra keyword (not
documented currently) called :eol. This keyword is present in updated
versions of ACL/Win (i.e. you have to download the latest updates from
franz). The :eol keyword specifies the mapping of #\newline (and
#\return, since #\return is #newline in ACL/Win) when you write to the
socket. By default :eol is set to #\linefeed. Thus whenever you write
a #\newline or #\return to the socket, it gets translated to
#\linefeed.
Currently you can not turn off this "newline" translation by setting
:eol to say nil. So to turn it off use the knowledge that in ACL/Win
(eq #\return #\newline)
and set :eol to #\return when using make-socket, e.g.
(make-socket :eol #\return)
I'm not sure why (code-char 13) returns NIL, in fact, I see that
(char-code #\Return) returns 77 which happens to be the ascii code for
"M". (I realize the CR is Ctrl-M, perhaps this is a bug?)
Thanks to Sean Foderaro at Franz for the information.
Thanks to everyone who responded to my question.