diff --git a/phpgwapi/inc/class.xmlrpc_server_php.inc.php b/phpgwapi/inc/class.xmlrpc_server_php.inc.php index aa33f9bf4c..b01c2a54dc 100644 --- a/phpgwapi/inc/class.xmlrpc_server_php.inc.php +++ b/phpgwapi/inc/class.xmlrpc_server_php.inc.php @@ -92,10 +92,11 @@ } else { - $payload = "\n" . $this->serializeDebug() . $r->serialize(); + $payload = $GLOBALS['egw']->translation->convert("\n" . $this->serializeDebug() . $r->serialize(), + $GLOBALS['egw']->translation->charset(),'utf-8'); header("Content-type: text/xml"); - header("Content-length: " . strlen($payload)); - echo $GLOBALS['egw']->translation->convert($payload,$GLOBALS['egw']->translation->charset(),'utf-8'); + header("Content-length: " . $this->bytes($payload)); + echo $payload; } if ($this->log) @@ -119,10 +120,28 @@ fclose($fp); } } + + /** + * mbstring.func_overload save strlen version: counting the bytes not the chars + * + * @param string $str + * @return int + */ + function bytes($str) + { + static $func_overload; + + if (is_null($func_overload)) + { + $func_overload = @extension_loaded('mbstring') ? ini_get('mbstring.func_overload') : 0; + } + return $func_overload & 2 ? mb_strlen($str,'ascii') : strlen($str); + } + /* - add a method to the dispatch map - */ + * add a method to the dispatch map + */ function add_to_map($methodname,$function,$sig,$doc) { $this->dmap[$methodname] = array(