comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Convert wide_string to string (as the same byte array)
Date: Tue, 6 Mar 2012 19:04:30 -0600
Date: 2012-03-06T19:04:30-06:00	[thread overview]
Message-ID: <jj6c71$v37$1@munin.nbi.dk> (raw)
In-Reply-To: 5368448.8.1331049289886.JavaMail.geo-discussion-forums@pbbpr1

"Adam Beneschan" <adam@irvine.com> wrote in message 
news:5368448.8.1331049289886.JavaMail.geo-discussion-forums@pbbpr1...
> On Monday, March 5, 2012 5:58:48 PM UTC-8, Randy Brukardt wrote:
>>
>> An alternative to Adam's solution would be to use the Ada2012 encoding
>> functions (A.4.11), specifically Ada.Strings.UTF_Encoding.Wide_Strings, 
>> and
>> use a UTF-8 encoding. That would be shorter, but not fixed length, so
>> whether that would work for you depends on the API you are feeding these
>> into.
>
> This may seem like a dumb question, but does that preserve order?

My understanding was that UTF-8 was designed so that ordinary byte 
comparison operations would work "properly" on UTF-8 strings (presuming no 
"overlong encodings" are used; there is no point in such things, it's like 
including NOPs in your generated instructions). That's surely true if only 
equality is involved; I believe it is also true for ordering, but as I've 
never tried it I don't want to say for absolutely certain.

                                            Randy.





      reply	other threads:[~2012-03-07  1:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-24 22:01 Convert wide_string to string (as the same byte array) Erich
2012-02-24 22:25 ` Adam Beneschan
2012-02-24 22:58   ` Erich
2012-03-06  1:58 ` Randy Brukardt
2012-03-06 15:54   ` Adam Beneschan
2012-03-07  1:04     ` Randy Brukardt [this message]
replies disabled

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