[gtkada] UTF-8 in GtkAda 2.0

Jacob Sparre Andersen sparre at nbi.dk
Thu Mar 27 10:22:01 CET 2003


Preben Randhol wrote:
> Emmanuel Briot <briot at ACT-Europe.FR> wrote on 26/03/2003 (21:47) :

> > The conversion functions are all in Glib.Convert.
>
> OK but why isn't Wide_Strings used?

Probably because UTF-8 allows you to use all of ISO-10646
and not just the "basic multilingual plane" (BMP) of
ISO-10646.

> This UTF-8 stuff really confuses me.

And that is another reason for me to think it is incorrect
to implement the string handling as it is done in GtkAda 2.

> What I need is Latin7 (and also Latin2, Latin3 etc..)
> conversion to UTF-8. And how can I verify that the String
> is valid.

The package Glib.Convert (GtkAda) suplies functions for
converting between arbitrary character encodings (as long as
you know the strings that represents your source and target
encodings) and elsewhere in GtkAda there should be a
function for checking if an object of type Ada.String can be
used as if it was an UTF-8 encoded string for GtkAda.

The package Unicode.UTF8 (Ngeadal) supplies functions for
mapping between Ada.String, Ada.Wide_String,
Unicode.UTF32_String and Unicode.UTF8.UTF8_String, but not
for other ISO-8859-* encodings than ISO-8859-1.

Ngeadal's handling of character encodings is definitely more
to my liking than that of GtkAda, but I would definitely
prefer a library, where the UTF-8 string type was a private
type, so I was prevented from accidentaly invalidating the
content.

Jacob
-- 
56 dage, 10 timer og 55 minutter uden svar:
    http://www.sslug.dk/emailarkiv/forening/2003_01/msg01061



More information about the gtkada mailing list