From 5f228355ef85501c08dcd4aa7648f337cf9c1e27 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 19 May 2007 04:37:14 +0000 Subject: [PATCH] "fixed bug reported on the userlist: partial content under mbstring.func_overload&2" --- phpgwapi/inc/class.xmlrpc_server_php.inc.php | 29 ++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) 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(