On 2003-09-10 12:14:25 +0200, Bart Lateur wrote: > On Wed, 10 Sep 2003 10:40:29 +0100, Steve Hay wrote: > > >But the question was: How can I arrange for such conversions to be > >performed automatically by DBI whenever it receives or returns data? > > Well, there are two options... either does the dtabase somewhere stores > the flag indicating that some string is in UTF8, or you have to add that > information yourself. For the latter, I don't know if it'll actually > work, but it seems like an appropriate way to do it: add a "BOM" marker > at the start of the string.
That doesn't help Steve. He already knows that the data is UTF-8, he doesn't need the marker to distinguish between UTF-8 and Latin-X. His problem is that when he selects from the database, he has to manually convert from utf-8 to "perl-internal": while (my ($foo, $bar) = $sth->fetchrow_array()) { $foo = decode_utf8($foo); $bar = decode_utf8($bar); # do something with foo and bar } and he wants to happen the decode step automatically. Since MySQL 4.1 does support UTF-8: Is it possible to upgrade from MySQL 3.23 to 4.1? hp -- _ | Peter J. Holzer | Unser Universum wäre betrüblich |_|_) | Sysadmin WSR / LUGA | unbedeutend, hätte es nicht jeder | | | [EMAIL PROTECTED] | Generation neue Probleme bereit. __/ | http://www.hjp.at/ | -- Seneca, naturales quaestiones
pgp00000.pgp
Description: PGP signature