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: Mon, 5 Mar 2012 19:58:48 -0600
Date: 2012-03-05T19:58:48-06:00	[thread overview]
Message-ID: <jj3r0r$653$1@munin.nbi.dk> (raw)
In-Reply-To: f88cc8ca-183a-40c7-a01c-2adc1137d845@b18g2000vbz.googlegroups.com

"Erich" <john@peppermind.com> wrote in message 
news:f88cc8ca-183a-40c7-a01c-2adc1137d845@b18g2000vbz.googlegroups.com...
>A newbie question: I need to convert a wide_string to a (platform/
> endian independent) string that represents all the bytes of the
> wide_string. How do you do that?

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.

                                           Randy.





  parent reply	other threads:[~2012-03-06  1:58 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 [this message]
2012-03-06 15:54   ` Adam Beneschan
2012-03-07  1:04     ` Randy Brukardt
replies disabled

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