[gtkada] How to store an UTF8-String

Adrian Knoth adi at drcomp.erfurt.thur.de
Sat Dec 21 12:19:46 CET 2002


Hi,

I'm not sure who's fault it is, perhaps I should blame GTK (C) or myself
for outstanding stupidity :) If I interprete the following line in
glib-convert.ads correctly, than this function returns me an UTF8-encoded
version from my locale-encoded (Latin1) string:

   function Locale_To_UTF8 (OS_String : String) return String;
   --  Same as procedure Locale_To_UTF8, but return only the String.

This always worked well as long as I've used this function for the
GtkAda-Widget. Now I'm trying to use it to convert system-data from
Latin1 to UTF8. Here is an example:

with Glib.Convert; use Glib.Convert;

procedure gtktest is
   output : String := Locale_To_UTF8 ("ä");
begin
   null;
end gtktest;

Running this program results in:

adi at drcomp:~/ada/work/test/neu/db2utf8$ ./gtktest

raised INTERFACES.C.STRINGS.DEREFERENCE_ERROR : i-cstrin.adb:182

which means that the string returned from the C-function is a NULL-Pointer.

What's wrong?

-- 
mail: adi at thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Bill G. ist ein echter Magier. Er kann aus Scheiße Gold machen.




More information about the gtkada mailing list