Re: Display Japanese Characters in GtkComboBox



Modify your program and add "use warnings;" and check if perl complains
about "wide characters in print".

Did this but no warnings about 'wide characters in print'.

Add the following to your loop:
use Endode;
print "is kanji in UTF-8? ", (is_utf8($ref->{'kanji'}, 1) ? 'YES' : 'NO'),
"\n";

This was interesting.  It says that all of the kanji:
is kanji in UTF-8? NO

Is there a way I can determine what encoding they are in?

I'm afraid that this will only affect the low level communication between
the mysql.so library and the server. What's important for your application
is that the perl string are marked as being valid UTF-8 (perl strings have
an internal flag for this purpose).

Thanks for this info.  Wasn't really sure if it would have any
relevance but thought I should include it.

Apart from finding out what the actual encoding is I have been able to
display the kanji in the GtkComboBox by doing the following:

    while (my $ref = $sth->fetchrow_hashref)
    {
        my $string = decode("utf8", $ref->{'kanji'});
     .....
     }

Although I'd much prefer to know what encoding it actually is in, as
no doubt I'll hit similar problems when I start trying to insert
data...

Thanks for all your help so far.

Peter.



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