According to this thread
http:[EMAIL PROTECTED]/msg10537.html, charset
encoding is not a DBI issue, unless proven there is something wrong :-)
This simple test case with DBI 1.25 and Pg driver 1.01 returns wrong
characters with double utf8 conversion : the value "H�" from the database is
transformed in "H􀀰礀" in the document. According to LibXML
author, this happen when utf8 strings are not explictly marked as such.
use DBI;
use XML::LibXML;
use strict;
# global variables
my $doc = new XML::LibXML::Document;
my $root = $doc->createElement('authors');
$doc->setDocumentElement($root);
my $dbh = DBI->connect('DBI:Pg:dbname=olacacea;host=localhost;port=5432');
my $sth = $dbh->prepare('SELECT * FROM authors ORDER BY index');
$sth->execute();
# get authors
while (my $record = $sth->fetchrow_hashref()) {
my $author = $doc->createElement('author');
my $name = $doc->createElement('name');
my $name_text = $doc->createTextNode($record->{name});
$name->appendChild($name_text);
$author->appendChild($name);
$author->setAttribute('id', $record->{index});
$root->appendChild($author);
}
$sth->finish();
--
Guillaume Rousse <[EMAIL PROTECTED]>
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html