Workarounds
From The Lyceum Wiki
character encoding and XML-RPC
If your platform default encoding is ISO-8859-1, your blog encoding is UTF-8, and that you post in UTF-8, all your accentuated characters will get messed. You'll have to patch 'lib/wp-includes/class-IXR.php' as follow. Find the 'parse()' function, and replace its beginning by
function parse() {
// first remove the XML declaration
$rx = '/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m';
if (preg_match($rx, $$this->message, $m)) {
$encoding = strtoupper($m[1]);
} else {
$encoding = "UTF-8";
}
$this->message = preg_replace('/<\?xml(.*)?\?'.'>/', "", $this->message);
if (trim($this->message) == "") {
return false;
}
$this->_parser = xml_parser_create($encoding);
(...)
Thanks to http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss for the info.
Last but not least, if you have accentuated characters in your categories, and if your blog isn't in UTF-8, this patch might be usefull for you. It sets the encoding on the outgoing XMLs to be the encoding of your blog. Edit the file xmlrpc.php, find the line
function sayHello($args) {
and add before it this function:
function output($xml) {
$xml = '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?>'."\n".$xml;
$length = strlen($xml);
header('Connection: close');
header('Content-Length: '.$length);
header('Content-Type: text/xml');
header('Date: '.date('r'));
echo $xml;
exit;
}
it will override the function from the XML server, to declare the proper encoding on outgoing files.
