Re: Some strings corrupted when inserting into liststore model



Right. I found a hack on https://perldoc.perl.org/perlunicode ( which
you directed me to ) that appears to have fixed *this* particular
issue ( though it's not clear what I've then broken as a result )
Calling:

Encode::_utf8_on($_)

 ... for every value just prior to being pushed into the model appears
to work. Yay :)

Thanks!

Dan

On Mon, Oct 18, 2021 at 11:12 PM Jeremy Volkening via gtk-perl-list
<gtk-perl-list gnome org> wrote:

On Mon, Oct 18, 2021 at 08:39:36PM +1100, Daniel Kasak via gtk-perl-list wrote:
It's not really clear if there's something *else* I'm
supposed to do to these strings coming out of the DB or not?

Typically you need to tell Perl to treat them as UTF-8. Without knowing exactly how you're getting your 
strings into Perl, there are a number of ways to do this (https://perldoc.perl.org/perlunicode). For 
instance, if you're reading from a filehandle you can set its mode:

binmode(\*STDIN, ':utf8');

Or you can can specifically mark the string after it's imported:

use Encode;
$str = Encode::decode("UTF-8", $str);

One of these might help with your issue.

Jeremy
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]