Re: Insertion of character inside a TCP frame
Marco Antoniotti <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.general |
|---|---|
| Message-ID | <CAG0Nw2n8vs5_HZDO6j_P4dyAA3-UbY8E_7rD7MrOaqHMLzofoA@mail.gmail.com> |
Hi Stephane you may want to have a look at *babel* and maybe *cl-pack* for encoding and decoding. I am sure there are others around and some of them may suffer from some bit rot. All the best Marco On Tue, Jul 16, 2024 at 9:49 AM Christophe Rhodes <[email protected]> wrote: > "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 > > > _______________________________________________ > Sbcl-help mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/sbcl-help > -- Marco Antoniotti, Professor tel. +39 - 02 64 48 79 01 DISCo, University of Milan-Bicocca U14 2043 http://dcb.disco.unimib.it Viale Sarca 336 I-20126 Milan (MI) ITALY _______________________________________________ Sbcl-help mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sbcl-help