From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.129.46.145 with SMTP id u139mr7260114ywu.11.1470937209994; Thu, 11 Aug 2016 10:40:09 -0700 (PDT) X-Received: by 10.157.45.97 with SMTP id v88mr337720ota.4.1470937209946; Thu, 11 Aug 2016 10:40:09 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!j37no7974928qta.0!news-out.google.com!d68ni24271ith.0!nntp.google.com!f6no9177247ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 11 Aug 2016 10:40:09 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2001:8a0:6a4f:fe01:b44b:9abb:7567:a522; posting-account=nd46uAkAAAB2IU3eJoKQE6q_ACEyvPP_ NNTP-Posting-Host: 2001:8a0:6a4f:fe01:b44b:9abb:7567:a522 References: <267bd80f-b388-4df6-b712-315ee9bda2b8@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <90caee48-5fa7-47d7-aad5-761e11225e2c@googlegroups.com> Subject: Re: A few questions on parsing, sockets, UTF-8 strings From: john@peppermind.com Injection-Date: Thu, 11 Aug 2016 17:40:09 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:31397 Date: 2016-08-11T10:40:09-07:00 List-Id: On Thursday, August 11, 2016 at 5:24:06 PM UTC+1, Dmitry A. Kazakov wrote: >=20 > The user input buffer is the buffer you provide. TCP/IP stream ignores=20 > whatever line terminators. They are just bytes as anything else. You=20 > read until a complete line is in the buffer then do whatever you have to= =20 > with the line. Thanks, that's what I thought. Just wanted to make sure there is no showsto= pper before I start. (I need to be able to get the port from the listening = socket *before* a connection is made.) > I have one: >=20 > http://dmitry-kazakov.de/ada/strings_edit.htm#12 Great, I'll take a look at it. I'm still confused, though. Strings are really kind of a mess in Ada, IMHO.= Do I really need your package? Or could I use String instead? Suppose the = GPS source code option is set to UTF-8, so a string literal in the source c= ode should be UTF-8 data (inside a fixed String type). Right? So if I Base6= 4 encode this directly, do I have to care about UTF-8? > P.S. There is no point using Base64 encoding over TCP/IP unless a=20 > specific protocol requires it. I agree, and it's my own protocol, but in this case I believe Base64 makes = sense despite the inefficiency. The protocol should be as easy as possible = to implement in basically any language that has strings and TCP sockets, an= d many languages have built-in Base64 encoders and decoders. Base64 without LFs and CRs is a brute-force way of string escaping in this = case. Originally I used string escapes like in Scheme and Lisp with an appr= opriate reader. That's nice for debugging, but way too complicated for pars= ing. Since Base64 does not contain spaces either, I can split strings on wh= itespace when a line is read, and many languages have built in commands for= this, too.