Re: utf8 not displayed in Gtk2::Entry

* Alexandre Jousset <mid gtmp org> [2005-08-15 12:10]:
I am working on a Gtk2-Perl project which is an LDAP browser. I
get utf-8 strings from an LDAP directory and when I set them in
a Gtk2::Entry, they are not displayed correctly: utf-8 strings
are shown as the usual wrong characters eg.
capital_tilde_A-copyright for the accented_e. I thought Gtk2
used utf-8. Can you tell me what's wrong ?

The strings are probably not marked as UTF-8, in which case Perl
assumes theyâre in your local encoding. Use the `Encode` moduleâs
`decode_utf8` function on the data you get, ie something along
the lines of

    use Encode;
    $info = decode_utf8( get_info_from_ldap_somehow() );

Although if you are using some sort of module to talk to the LDAP
server, then it really is that moduleâs job to do this correctlyâ

*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};

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