Re: String Encocoding in Gtk-Perl: Hoping for Clarification



On Sun, 2010-05-09 at 10:49 -0400, Alejandro Imass wrote:
Don't know if this is actually related to your problem, but from my
experience GTK or Gnome itself does not support UTF-8 but only single
byte charsets, so you need to convert to a single-byte encoding that
is able to be rendered by Gnome. This is what I do for example:

use Encode;

[...]

my $msg = "UTF-8 TEXT";

Encode::from_to($msg,'utf8','iso-8859-1');

  my $dialog = Gtk2::MessageDialog->new ($parent,
                                         'destroy-with-parent',
                                         'question',
                                         'yes-no',
                                         $msg);


This is very wrong. As said by others Gtk2 only supports utf8, nothing
else.

Your problem is (most likely) that $msg contains utf8 data, but perl
doesn't know. 

If you change you code to use decode_utf8 rather than from_to, you
should see that it works.

$msg= decode_utf8( $msg );

This will let your utf8 data stay utf8 and still work. In your example
before my guess is that before from_to length and other perl buildins
will not work right on $msg.

I hope that made sense.

./borup




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