Bill Moseley schrieb am 20.05.2011 um 06:34 (-0700): > On Fri, May 20, 2011 at 2:06 AM, Summer <[email protected]> wrote: > > > My problem is, i am generating xml and that uses the UTF-8 charset > > declaration and some of the data is in french/german/spanish and I > > am getting invalid xml because of it. It seems that the transition > > INTO the db is somehow mucking up. So I am curious if I can take > > that data handed to me, from the db, and massage it into UTF-8 > > compliant and then write the xml (xml is generated via inline tt > > file). > > It's not a job for Template Toolkit.
I agree. Consider using XML::Writer or XML::LibXML to generate XML. * http://p3rl.org/XML::Writer * http://p3rl.org/XML::LibXML > Pull the data out of the database use Encode::decode_utf8() with a > useful value for CHECK (die ore substitute). Write your template and > use Encode:encode_utf8() when done. > You need to figure out how data is getting into the database not > encoded consistently. Always encode before writing your characters > anyplace. Your database driver (DBD::???) might have a setting to encode on input and decode on output, e.g. mysql_enable_utf8 in DBD::mysql. * http://p3rl.org/DBD::mysql -- Michael Ludwig _______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates
