Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
where DB_insertdata is (among other things) in FW::Database:use FW::Database; use XML::Parser; . .# a lot of stuff that constructs $stmt . DB_insertdata($stmt, $dbh);
When printing $stmt either into the browser or via STDERR in the error.log everything is ISO, but when the same string is inserted via DBI I get unicode in the database! So, the current urgency workaround is forget agbout DBI and replacing DB_insertdata withpackage FW::Database; require Exporter; use vars qw(@ISA @EXPORT %conf); @ISA = qw(Exporter); @EXPORT = qw( &DB_insertdata ); sub DB_insertdata { my $stmt = $_[0]; my $dbh = $_[1]; my $error = ""; my $sth = $dbh->prepare($stmt) || FW::Utils::handle_dberror("$DBI: +:errstr", $dbh); my $rv = $sth->execute() || FW::Utils::handle_dberror("$DBI::errst +r", $dbh); }
which works but is of course very far away from being acceptable code.open (PIPE, "|/usr/local/mysql/bin/mysql -u user database"); print PIPE $stmt; close(PIPE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl 5.8, DBI and unicode
by CountZero (Bishop) on Dec 23, 2002 at 14:59 UTC | |
by hmerrill (Friar) on Dec 23, 2002 at 15:12 UTC | |
by Anonymous Monk on Dec 23, 2002 at 15:54 UTC |