Re: unicode in a liststore



On Fri, Mar 6, 2015 at 3:20 PM, Daniel Kasak <d j kasak dk gmail com> wrote:
If I can actually get valid unicode out of a database, I'm *still* having
issues pushing it into a liststore. Things get corrupted. I've modified
liststore.pl from https://github.com/dave-theunsub/gtk3-perl-demos and
uploaded the changed version to:

http://tesla.duckdns.org/downloads/unicode_in_liststore.pl

Near the top, I've appended another row for the liststore, with the unicode
string:

GestiĆ³n

It's actually not a Gtk3 thing, it's a Perl thing.

https://gist.github.com/cpanxaoc/7d4fcd98e3c580527246

Note line #12 of that gist.  Just for shits and giggles, I changed
some of your strings output in the liststore to add more UTF-8-ness.
Perl 5.20.2, Gtk3 0.021, Glib 1.310 on Mac OS X Mavericks (10.9.5).

From http://perldoc.perl.org/perlunicode.html:

"As a compatibility measure, the use utf8 pragma must be explicitly
included to enable recognition of UTF-8 in the Perl scripts themselves
(in string or regular expression literals, or in identifier names) on
ASCII-based machines or to recognize UTF-EBCDIC on EBCDIC-based
machines. These are the only times when an explicit use utf8 is
needed. See utf8."

I thought the above became the default at some point, but according to
the current docs, you still need the 'use utf8;' pragma.

As far as the database, I would ask if you've enabled UTF-8 everywhere
that you possibly can.  Also, I've had this happen to me in the past,
things I expected to be UTF-8 sometimes weren't; if you get high-byte
ASCII in your data, most UTF-8 string handling routines will become
very unhappy.

Thanks,

Brian


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