In the case of your example script, you need 'use utf8;' in the preamble. This fixes handling of the hard-coded unicode characters in the script -- it won't necessarily fix the issue with the strings coming from your database. Are you certain they are being stored in the database correctly?
Jeremy On Mon, Oct 18, 2021 at 02:42:42PM +1100, Daniel Kasak via gtk-perl-list wrote: > Hi all. I'm seeing some strings ( coming from a database ) corrupted > when I insert into a liststore model. I've pasted a bare-bones script > before which demonstrates the issue ( hard-coded string value in this > case ). Any ideas what's happening and how to get the original string > rendering? Interestingly, I can copy/paste directly into the > treeview/cell and it handles data input this way. > > --- > > #!/usr/bin/perl > > use strict; > use warnings; > > use Gtk3 '-init'; > use Glib 'TRUE', 'FALSE'; > > use Encode; > > my $window = Gtk3::Window->new; > $window->signal_connect( destroy => sub { Gtk3->main_quit } ); > $window->set_border_width(8); > $window->set_default_size( 300, 250 ); > > my $box = Gtk3::Box->new( 'vertical', 8 ); > $box->set_homogeneous(FALSE); > $window->add($box); > > my $sw = Gtk3::ScrolledWindow->new( undef, undef ); > $sw->set_shadow_type('etched-in'); > $sw->set_policy( 'never', 'automatic' ); > $box->pack_start( $sw, TRUE, TRUE, 5 ); > > # Create TreeModel > my $model = Gtk3::ListStore->new( 'Glib::String', ); > my $iter = $model->append(); > $model->set( $iter , 0 , "└─Selection_6" ); > > # Create a TreeView > my $treeview = Gtk3::TreeView->new($model); > $treeview->set_rules_hint(TRUE); > $treeview->set_search_column(0); > $sw->add($treeview); > > # Add columns to TreeView > add_columns($treeview); > > $window->show_all; > Gtk3->main(); > > sub add_columns { > my $treeview = shift; > my $model = $treeview->get_model(); > my $renderer = Gtk3::CellRendererText->new; > # Column for description > my $column = Gtk3::TreeViewColumn->new_with_attributes( > 'Description', $renderer, text => 0 ); > $column->set_sort_column_id(0); > $treeview->append_column($column); > } > _______________________________________________ > gtk-perl-list mailing list > gtk-perl-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-perl-list _______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-perl-list