in reply to Extracting data from Postgres database to XML via Perl - encoding issue
According to the XML::Generator::DBI manual that might also fix the base64 issue, unless you have characters that the XML specification forbids.