[Gambas-user] Loading non UTF-8 text files to TextArea

Benoît Minisini gambas at ...1...
Sat Sep 6 20:45:24 CEST 2014


Le 06/09/2014 20:29, Patrik Karlsson a écrit :
> Hi,
>
> I got: Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion
> 'g_utf8_validate (text, len, NULL)' failed
> when trying TextArea.Text=File.Load("iso8859-1.txt")
>
> So my TextArea stays empty.

If the file contents is not UTF-8, it's up to you to convert it to UTF-8.

TextArea.Text = Conv(File.Load("iso8859-1.txt"), "ISO-8859-1", "UTF-8")

>
> I have found an old bug report regarding this tagged as wont fix.
>
> Since the file loads as expected in qt, is it future safe to use qt in my
> app, will it always work?
>
> Does qt support "every other" encoding too?
> Im asking since Im working on a gui for iconv.
>
> /Patrik

It should not work in Qt either, unless it has some automatic conversion 
inside, or it is more tolerant.

Regards,

-- 
Benoît Minisini




More information about the User mailing list