Re: Some strings corrupted when inserting into liststore model



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


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