Re: Insertion of character inside a TCP frame

Christophe Rhodes <[email protected]>
Newsgroups gmane.lisp.steel-bank.general
Message-ID <[email protected]>
"steph.tougard via Sbcl-help" <[email protected]> writes:

> For those who don't know, SMPP is a binary protocol over TCP to send
> SMS. Unlike SMPP or HTTP, each frame is sent or received between the

SMPP is a binary protocol, but your Lisp code uses characters and
strings.  This means that there will be an encoding step on the Lisp
side, to convert from characters to binary.

In most lisps nowadays, the default encoding scheme is probably utf-8,
which encodes the ASCII repertoire (the first 128 characters of Unicode)
as single bytes, but uses multiple bytes for all other characters.

I would guess that the string that you are attempting to send contains a
character with char-code greater than 127, and that your stream is set
up to convert characters using utf-8.

You are using usocket, which does not allow users to specify external
formats directly.  You could try setting
sb-ext:*default-external-format* to :latin-1 before starting your
server, or you could send binary (rather than string) data to your
socket, performing the character to binary conversion yourself rather
than making it implicit.

Christophe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.