jdtoronto has asked for the
wisdom of the Perl Monks concerning the following question:

Esteemed monks,

SOAP::Lite has bitten me yet again. I have an application that queries a server which returns data from a MySQL database. Everything is fine - as long as there are no 'oddball' characters in the data. For example, I need do nothing more than add an é ( 0xE9 according to the Windows character map ) and then the whole thing stops. The table in MySQL has been defined with a character set of UTF-8.

Since DBD::MySQL only has very limited and experimental support for utf-8, what encoding is the output message in? You might need to do an explicit encode() to utf8 or whatever encoding your XML output is expecting.

Ok, but encoding mismatches still might be the source of the problem: if your (SOAP) xml prolog and/or HTTP headers end up with the wrong indication for the character encoding, it's likely you'll run into trouble somewhere. IIRC perl will use either utf-8 or latin-1 for 'high-bit' encoding.

You probably expect your XML to be in one or the other, so you need to be sure the data in it is correctly encoded. If everything else is working correctly, doing an Encode::encode() to utf-8 or latin-1 over the whole resulting XML response and a binmode() to :bytes (or possibly just a binmode to utf8 if that's what you're using) should work.