Some strings corrupted when inserting into liststore model



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);
}


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