fraktalisman has asked for the wisdom of the Perl Monks concerning the following question:
Although Perl seems to handle UTF-8 correctly, this is not the case when reading data with DBI::MySQL. In disussions on CPAN and elsewhere, I read about the solution, to set the utf8 flag for the database data by calling Encode::decode_utf8.
I have still a problem with Encode::decode_utf8. If the string to be decoded is already UTF-8, Encode::decode_utf8 returns an empty string! There seems to be no way to check if decoding is necessary, because in both cases (decoding successful or empty string), the string to be decoded was marked as "not utf" when I test it with Encode::is_utf8 .
Is there a good way to avoid this problem?
And what will happen, if a future version of DBI and DBD already handles the SQL data correctly? Will the decoding still work, or do we have to re-write all scripts then?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Handle UTF-8 with DBI
by borisz (Canon) on Jan 03, 2006 at 17:36 UTC | |
Re: Handle UTF-8 with DBI
by idsfa (Vicar) on Jan 03, 2006 at 17:25 UTC | |
Re: Handle UTF-8 with DBI
by ioannis (Abbot) on Jan 03, 2006 at 18:34 UTC | |
Re: Handle UTF-8 with DBI
by valdez (Monsignor) on Jan 03, 2006 at 20:44 UTC | |
Re: Handle UTF-8 with DBI
by Errto (Vicar) on Jan 04, 2006 at 15:28 UTC | |
Re: Handle UTF-8 with DBI
by fraktalisman (Hermit) on Jan 04, 2006 at 15:16 UTC | |
Re: Handle UTF-8 with DBI
by randyk (Parson) on Jan 05, 2006 at 03:15 UTC | |
Re: Handle UTF-8 with DBI (JS problem rather than a perl one)
by fraktalisman (Hermit) on Jan 14, 2006 at 11:07 UTC |