Re: UTF8



On Mon, Oct 28, 2002 at 08:43:42PM +0100, Jens Luedicke wrote:
I came across a problem with non-UTF8 strings (as returned by an function).
gtk2-perl refused to display them and gave an error message. 
I used Unicode::String to convert them.

--- snip ------------------------
#!/usr/bin/perl -w

use Unicode::String qw(latin1 utf8);
use Gtk2::Button;

Gtk2->init(\ ARGV);
my $str = latin1(shift)->utf8;
my $window = Gtk2::Window->new('toplevel');
my $button = Gtk2::Button->new($str);
$button->signal_connect('clicked', \&handler, undef);
$window->add($button);
$window->show_all;
Gtk2->main;

sub handler { Gtk2->quit; }
--- snip ------------------------
give it a latin1 as argument,
whines a bit but works at least with perl 5.8

 



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