[Tickets #8685] Re: Json utf8 respons object

bugs at horde.org bugs at horde.org
Sat Nov 7 12:46:50 UTC 2009


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8685
------------------------------------------------------------------------------
  Ticket             | 8685
  Updated By         | roman at stachura.ch
  Summary            | Json utf8 respons object
  Queue              | Horde Framework Packages
  Version            | FRAMEWORK_3
  Type               | Bug
  State              | Feedback
  Priority           | 2. Medium
  Milestone          | Horde 3.3.5
  Patch              |
  Owners             |
------------------------------------------------------------------------------


roman at stachura.ch (2009-11-07 07:46) wrote:

>> In Horde 3.3.5 the response object from Kronolith is using wrong charset.
>>
>> If Horde API is used to Power External Sites like this one:
>> http://theupstairsroom.com/67
>>
>> Problem:
>> Strings get cut off
>>
>> Reason:
>> kronolith/lib/Driver/sql.php (line 453)
>> Kronolith_Event_sql turns all utf8 strings into
>> $GLOBALS['_HORDE_STRING_CHARSET'] = 'iso-8859-1';
>
> What version of Kronolith is this?

Horde Groupware 1.2.4
Kronolith H3 (2.3.2)
kronolith/lib/api.php,v 1.126.2.64 2009/09/04 10:38:36 jan Exp $

> That line number has nothing to do with charset conversion,
> and furthermore, nowhere do we use  
> $GLOBALS['_HORDE_STRING_CHARSET']. Are you sure this isn't a local  
> modification?

Procedure during the a json call server side:

1. json is calling function &_kronolith_eventFromUID($uid) -->  
kronolith/lib/api.php line 1133
2. the event object get fetched:  $event =  
$GLOBALS['kronolith_driver']->getByUID($uid) --> kronolith/lib/api.php  
line 1137
-------------
    Get an event or events with the given UID value in   
kronolith/lib/Driver/sql.php,v 1.213 2008/10/18 04:20:42
    3. call function: &getByUID($uid, $calendars = null, $getAll =  
false) --> kronolith/lib/Driver/sql.php line 416
    4. the event get cached :  
$this->_cache[$this->_calendar][$event['event_id']] = &new  
Kronolith_Event_sql($this, $event) --> kronolith/lib/Driver/sql.php  
line 453
    5. call fromDriver(SQLEvent) in the class Kronolith_Event_sql  
method fromDriver($SQLEvent) kronolith/lib/Driver/sql.php line 871
    6. call $driver->convertFromDriver($SQLEvent['event_description'])  
--> kronolith/lib/Driver/sql.php line 948
    7. Converts a value from the default charset to the driver's  
charset String::convertCharset($value, $this->_params['charset'])  
kronolith/lib/Driver/sql.php line 803
------------
       The String:: class provides static methods for charset and  
locale safe framework/Util/String.php,v 1.43.6.37 2009/03/30 15:31:38
       8.call function convertCharset($input, $from, $to = null)  
framework/Util/String.php line 76
       on top of this file the $GLOBALS['_HORDE_STRING_CHARSET'] =  
'iso-8859-1'; is set.
------------
This is way we get an iso-8859-1 formated event back from kronolith.

json does not like iso-8859-1.This leads us back on track:
------------
framework/RPC/RPC/jsonrpc.php,v 1.9 2009/02/21 01:58:14 chuck Exp

call function getResponse($request) --> framework/RPC/RPC/jsonrpc.php line 47
return Horde_Serialize::serialize($response, Horde_Serialize::JSON)  
--> framework/RPC/RPC/jsonrpc.php line 88

       We have to make sure, that all strings in this responseheader are utf8.
       for this we should add the propper charset in   
Horde_Serialize::serialize($response, Horde_Serialize::JSON,  
"CHARSET") <---
       or make somehow sure, that we get all respondehaeder for json utf8.

------------
    $Horde: framework/Serialize/Serialize.php,v 1.25.10.16 2009/01/06  
15:23:34 jan Exp $

    // $params = Source character set
    case SERIALIZE_JSON in function _serialize($data, $mode, $params =  
null) --> framework/Serialize/Serialize.php line 264


regards roman






More information about the bugs mailing list