comp.lang.ada
 help / color / mirror / Atom feed
From: "Björn Persson" <spam-away@nowhere.nil>
Subject: Re: UTF-8 in strings - a bug?
Date: Thu, 06 May 2004 17:13:49 GMT
Date: 2004-05-06T17:13:49+00:00	[thread overview]
Message-ID: <hnumc.58314$mU6.237251@newsb.telia.net> (raw)
In-Reply-To: <200456-112553-85684@foorum.com>

Ludovic Brenta wrote:

> You can learn 
> about which encoding is currently in effect using the getlocale(3) 
> library call.

My understanding from the manpages is that you must first call 
setlocale(LC_ALL, "") to import the locale settings from the environment 
into the program, and then you call either nl_langinfo or localeconv to 
get information about the locale. I don't seem to have a manpage for 
getlocale.

> I am not aware of a thick binding to either getlocale or iconv (both 
> are in glibc).  If you write such a binding, it would be nice to make 
> it GMGPL.

There are lots of things I'd want to write. And now I can't stop 
thinking about how such a binding might be written ... :-/

> In the general case, though, you do not necessarily have to transcode 
> unless you want to manipulate the string data with algorithms that 
> depend on the internal encoding.

Of course. I just wish the OS interface wouldn't use String when the 
encoding is undefined. Better define a type System_String or something, 
and state explicitly that this type contains strings in whatever 
encoding is used in the environment.

> GtkAda does this explicitly with a separate type, UTF8_String.

That's good. What bothers me is when String is used for anything so you 
don't know what you really have in your strings. The C programmers can 
keep that kind of confusion to themselves. Separate types is clearly the 
way to go.

-- 
Björn Persson

jor ers @sv ge.
b n_p son eri nu




  reply	other threads:[~2004-05-06 17:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-05 22:12 UTF-8 in strings - a bug? Björn Persson
2004-05-05 23:31 ` Robert I. Eachus
2004-05-06  8:34   ` Björn Persson
2004-05-06  9:25     ` Ludovic Brenta
2004-05-06 17:13       ` Björn Persson [this message]
2004-05-06 18:24       ` Martin Krischik
2004-05-07 23:32         ` Björn Persson
2004-05-08  6:38           ` Martin Krischik
2004-05-08  7:44           ` Jacob Sparre Andersen
2004-05-08 11:06             ` Björn Persson
2004-05-08 16:25               ` Martin Krischik
2004-05-09 12:16                 ` Georg Bauhaus
2004-05-10  6:29                   ` Martin Krischik
2004-05-08 12:10           ` Georg Bauhaus
2004-05-06  9:06 ` David Starner
2004-05-06 17:36   ` Björn Persson
replies disabled

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