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

Patrik Karlsson pata.karlsson at ...626...
Mon Sep 8 16:07:18 CEST 2014


2014-09-06 20:45 GMT+02:00 Benoît Minisini <gambas at ...1...>:

> 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
>
> "It should not work..." :) In that case I'll be using Conv(), thanks!

/Patrik



More information about the User mailing list