comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: A few questions on parsing, sockets, UTF-8 strings
Date: Thu, 11 Aug 2016 19:49:21 +0200
Date: 2016-08-11T19:49:21+02:00	[thread overview]
Message-ID: <noidr9$atk$1@gioia.aioe.org> (raw)
In-Reply-To: 90caee48-5fa7-47d7-aad5-761e11225e2c@googlegroups.com

On 2016-08-11 19:40, john@peppermind.com wrote:

> 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?

Instead of what?

> Suppose the GPS source code option is set to UTF-8, so a string literal
> in the source code should be UTF-8 data (inside a fixed String type).
> Right?

ASCII string is an UTF-8 string. The reverse if false.

> So if I Base64 encode this directly, do I have to care about UTF-8?

No, if it is strictly ASCII. Yes, if you are going to use other Unicode 
code points.

>> P.S. There is no point using Base64 encoding over TCP/IP unless a
>> 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, and many languages have built-in Base64 encoders and decoders.

Then, what's the problem? Use no Base64 and no line terminators. Pass 
the packet length. Then, the packet contents. No encoding, no recording, 
always known how many bytes to read next.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2016-08-11 17:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11 14:39 A few questions on parsing, sockets, UTF-8 strings john
2016-08-11 16:23 ` Dmitry A. Kazakov
2016-08-11 17:40   ` john
2016-08-11 17:49     ` Dmitry A. Kazakov [this message]
2016-08-11 18:22       ` john
2016-08-11 19:09         ` gautier_niouzes
2016-08-11 21:10         ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox