diff --git a/phpgwapi/inc/xajax.inc.php b/phpgwapi/inc/xajax.inc.php index 602a049302..bfff81b8ad 100644 --- a/phpgwapi/inc/xajax.inc.php +++ b/phpgwapi/inc/xajax.inc.php @@ -41,14 +41,17 @@ ---------------------------------------------------------------------------- */ -/** - * Define XAJAX_DEFAULT_CHAR_ENCODING that is used by both - * the xajax and xajaxResponse classes - */ -if (!defined ('XAJAX_DEFAULT_CHAR_ENCODING')) -{ - define ('XAJAX_DEFAULT_CHAR_ENCODING', 'utf-8' ); -} +// RalfBecker: We can't allow to define the charset "now", as the eGW header is not yet included +// and we dont know the charset at this moment. It will be set in xajax.php after the header include! +// Please note: The use of this constant is also removed from the constructor further down! +///** +// * Define XAJAX_DEFAULT_CHAR_ENCODING that is used by both +// * the xajax and xajaxResponse classes +// */ +//if (!defined ('XAJAX_DEFAULT_CHAR_ENCODING')) +//{ +// define ('XAJAX_DEFAULT_CHAR_ENCODING', 'utf-8' ); +//} require_once(dirname(__FILE__)."/xajaxResponse.inc.php"); @@ -169,7 +172,9 @@ class xajax * @param string defaults to XAJAX_DEFAULT_CHAR_ENCODING defined above * @param boolean defaults to false */ - function xajax($sRequestURI="",$sWrapperPrefix="xajax_",$sEncoding=XAJAX_DEFAULT_CHAR_ENCODING,$bDebug=false) +// RalfBecker: using the not yet defined constant XAJAX_DEFAULT_CHAR_ENCODING, results in a warning, which messes up the xml +// function xajax($sRequestURI="",$sWrapperPrefix="xajax_",$sEncoding=XAJAX_DEFAULT_CHAR_ENCODING,$bDebug=false) + function xajax($sRequestURI="",$sWrapperPrefix="xajax_",$sEncoding='utf-8',$bDebug=false) { $this->aFunctions = array(); $this->aObjects = array(); @@ -1236,4 +1241,4 @@ function xajaxErrorHandler($errno, $errstr, $errfile, $errline) $GLOBALS['xajaxErrorHandlerText'] .= "\n----\n[$errTypeStr] $errstr\nerror in line $errline of file $errfile"; } -?> \ No newline at end of file +?> diff --git a/xajax.php b/xajax.php index 24e9f6615b..44c83bd6ac 100644 --- a/xajax.php +++ b/xajax.php @@ -21,6 +21,10 @@ */ function xajax_redirect(&$anon_account) { + // now the header is included, we can set the charset + $GLOBALS['xajax']->setCharEncoding($GLOBALS['egw']->translation->charset()); + define('XAJAX_DEFAULT_CHAR_ENCODING',$GLOBALS['egw']->translation->charset()); + $response =& new xajaxResponse(); $response->addScript("location.href='".$GLOBALS['egw_info']['server']['webserver_url'].'/login.php?cd=10'."';"); @@ -71,6 +75,7 @@ // now the header is included, we can set the charset $GLOBALS['xajax']->setCharEncoding($GLOBALS['egw']->translation->charset()); + define('XAJAX_DEFAULT_CHAR_ENCODING',$GLOBALS['egw']->translation->charset()); $ajaxClass =& CreateObject($appName.'.'.$className); $argList = $GLOBALS['egw']->translation->convert($argList, 'utf-8');