Summary | Json utf8 response object |
Queue | Horde Framework Packages |
Queue Version | FRAMEWORK_3 |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | |
Requester | roman (at) stachura (dot) ch |
Created | 11/06/2009 (5720 days ago) |
Due | |
Updated | 04/10/2010 (5565 days ago) |
Assigned | 11/06/2009 (5720 days ago) |
Resolved | 04/10/2010 (5565 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | 3.3.7 |
Patch | No |
before the utf-8 can take action.
same machine, virtual hosting etc...
I tested this on a productive machines and as fare is i can see the
json is working as expected.
thanks.
State ⇒ Resolved
before the utf-8 can take action.
The muche smarter way as i tried. Nomore back and forth conversions.
In theory this should fix the issue.
Unfortunately in the setCharsetEnvironment(){} function is another "bug".
(in NLS.php)
the NLS::setLang(); turns the charset back to iso,
before the utf-8 can take action.
Regards roman
described problem for me (had that problems with strings containing
german 'umlauts') - i use JSON with python-simplejson (in ZOPE)
externally. With XMLRPC i had not such charset problems.
good work ;)
hth
cheers,
Niels
---
Niels Dettenbach
http://www.syndicat.com
http://www.stadtradio-goettingen.de
might still have local modifications that interfere.
Will do a fresh install. Hope that helps.
still have local modifications that interfere.
Fix class name (
Bug #8685).http://cvs.horde.org/diff.php/framework/RPC/RPC/Attic/jsonrpc.php?rt=horde&r1=1.4.2.5&r2=1.4.2.6&ty=u
@return string The JSON encoded response from the server.
Still the same behavior for me.
+ return Horde_Serialize::serialize($response, SERIALIZE_JSON,
NLS::getCharset());
- return Horde_Serialize::serialize($response, SERIALIZE_JSON);
Might be this one:
http://cvs.horde.org/h/chora/annotate.php/framework/RPC/RPC/Attic/jsonrpc.php?sa=1&rev=1.5
+ return Horde_Serialize::serialize($response, SERIALIZE_JSON,
NLS::getCharset());
- return Horde_Serialize::serialize($response, SERIALIZE_JSON);
Fix class name (
Bug #8685).http://cvs.horde.org/diff.php/framework/RPC/RPC/Attic/jsonrpc.php?rt=horde&r1=1.4.2.5&r2=1.4.2.6&ty=u
Line 91
+ return Horde_Serialize::serialize($response, SERIALIZE_JSON,
NLS::getCharset());
- return Horde_Serialize::serialize($response, SERIALIZE_JSON);
Works for me.
in /horde3/lib/Horde/RPC/jsonrpc.php on line 44
I let you know as soon as i know more...
JSON is always UTF-8 (
Bug #8685).http://cvs.horde.org/diff.php/framework/RPC/RPC/Attic/jsonrpc.php?rt=horde&r1=1.4.2.4&r2=1.4.2.5&ty=u
--> Horde_NLS::setCharsetEnvironment('UTF-8');
JSON is always UTF-8 (
Bug #8685).http://git.horde.org/diff.php/framework/Rpc/lib/Horde/Rpc/Jsonrpc.php?rt=horde-git&r1=bfbf37ce80786f3a0d6c904509cc27d53698dd52&r2=bff9b6b204d6dac17d167c8aae9a64791c5535fd
Summary ⇒ Json utf8 response object
Milestone ⇒ 3.3.6
JSON is always UTF-8 (
Bug #8685).http://cvs.horde.org/diff.php/framework/RPC/RPC/Attic/jsonrpc.php?rt=horde&r1=1.4.2.4&r2=1.4.2.5&ty=u
Kronolith H3 (2.3.2)
kronolith/lib/api.php,v 1.126.2.64 2009/09/04 10:38:36 jan Exp $
and furthermore, nowhere do we use
$GLOBALS['_HORDE_STRING_CHARSET']. Are you sure this isn't a local
modification?
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
State ⇒ Feedback
with charset conversion, and furthermore, nowhere do we use
$GLOBALS['_HORDE_STRING_CHARSET']. Are you sure this isn't a local
modification?
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒ Horde 3.3.5
Summary ⇒ Json utf8 respons object
Type ⇒ Bug
Queue ⇒ Horde Framework Packages
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';
Solution:
/lib/Horde/RPC/jsonrpc.php
class Horde_RPC_jsonrpc();
function getResponse($request);
Line 91
-- return Horde_Serialize::serialize($response, SERIALIZE_JSON);
++ return Horde_Serialize::serialize($response, SERIALIZE_JSON,
$GLOBALS['_HORDE_STRING_CHARSET']);