<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>Json utf8 response object</title> 
  <pubDate>Fri, 10 Apr 2026 07:55:25 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/8685</link> 
  <atom:link rel="self" type="application/rss+xml" title="Json utf8 response object" href="https://bugs.horde.org/ticket/8685/rss" /> 
  <description>Json utf8 response object</description> 
 
   
   
  <item> 
   <title>In Horde 3.3.5 the response object from Kronolith is using w</title> 
   <description>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[&#039;_HORDE_STRING_CHARSET&#039;] = &#039;iso-8859-1&#039;;


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[&#039;_HORDE_STRING_CHARSET&#039;]);
</description> 
   <pubDate>Fri, 06 Nov 2009 17:35:05 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56544</link> 
  </item> 
   
  <item> 
   <title>&gt; In Horde 3.3.5 the response object from Kronolith is using</title> 
   <description>&gt; In Horde 3.3.5 the response object from Kronolith is using wrong charset.
&gt;
&gt; If Horde API is used to Power External Sites like this one:
&gt; http://theupstairsroom.com/67
&gt;
&gt; Problem:
&gt; Strings get cut off
&gt;
&gt; Reason:
&gt; kronolith/lib/Driver/sql.php (line 453)
&gt; Kronolith_Event_sql turns all utf8 strings into 
&gt; $GLOBALS[&#039;_HORDE_STRING_CHARSET&#039;] = &#039;iso-8859-1&#039;;

What version of Kronolith is this? That line number has nothing to do with charset conversion, and furthermore, nowhere do we use $GLOBALS[&#039;_HORDE_STRING_CHARSET&#039;]. Are you sure this isn&#039;t a local modification?
</description> 
   <pubDate>Fri, 06 Nov 2009 19:09:02 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56545</link> 
  </item> 
   
  <item> 
   <title>&gt;&gt; In Horde 3.3.5 the response object from Kronolith is usin</title> 
   <description>&gt;&gt; In Horde 3.3.5 the response object from Kronolith is using wrong charset.
&gt;&gt;
&gt;&gt; If Horde API is used to Power External Sites like this one:
&gt;&gt; http://theupstairsroom.com/67
&gt;&gt;
&gt;&gt; Problem:
&gt;&gt; Strings get cut off
&gt;&gt;
&gt;&gt; Reason:
&gt;&gt; kronolith/lib/Driver/sql.php (line 453)
&gt;&gt; Kronolith_Event_sql turns all utf8 strings into
&gt;&gt; $GLOBALS[&#039;_HORDE_STRING_CHARSET&#039;] = &#039;iso-8859-1&#039;;
&gt;
&gt; 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 $

&gt;That line number has nothing to do with charset conversion,
&gt; and furthermore, nowhere do we use 
&gt; $GLOBALS[&#039;_HORDE_STRING_CHARSET&#039;]. Are you sure this isn&#039;t a local 
&gt; modification?

Procedure during the a json call server side:

1. json is calling function &amp;_kronolith_eventFromUID($uid) --&gt; kronolith/lib/api.php line 1133
2. the event object get fetched:  $event = $GLOBALS[&#039;kronolith_driver&#039;]-&gt;getByUID($uid) --&gt; 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: &amp;getByUID($uid, $calendars = null, $getAll = false) --&gt; kronolith/lib/Driver/sql.php line 416
   4. the event get cached : $this-&gt;_cache[$this-&gt;_calendar][$event[&#039;event_id&#039;]] = &amp;new Kronolith_Event_sql($this, $event) --&gt; 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-&gt;convertFromDriver($SQLEvent[&#039;event_description&#039;]) --&gt; kronolith/lib/Driver/sql.php line 948
   7. Converts a value from the default charset to the driver&#039;s charset String::convertCharset($value, $this-&gt;_params[&#039;charset&#039;]) 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[&#039;_HORDE_STRING_CHARSET&#039;] = &#039;iso-8859-1&#039;; 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) --&gt; framework/RPC/RPC/jsonrpc.php line 47
return Horde_Serialize::serialize($response, Horde_Serialize::JSON) --&gt; 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, &quot;CHARSET&quot;) &lt;---
      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) --&gt; framework/Serialize/Serialize.php line 264


regards roman</description> 
   <pubDate>Sat, 07 Nov 2009 12:46:50 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56549</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

JSON is alwa</title> 
   <description>Changes have been made in CVS for this ticket:

JSON is always UTF-8 (Bug #8685).
http://cvs.horde.org/diff.php/framework/RPC/RPC/Attic/jsonrpc.php?rt=horde&amp;r1=1.4.2.4&amp;r2=1.4.2.5&amp;ty=u</description> 
   <pubDate>Sat, 07 Nov 2009 12:54:38 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56550</link> 
  </item> 
   
  <item> 
   <title>Please try what I committed.</title> 
   <description>Please try what I committed.</description> 
   <pubDate>Sat, 07 Nov 2009 12:55:23 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56552</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in Git for this ticket:

JSON is alwa</title> 
   <description>Changes have been made in Git for this ticket:

JSON is always UTF-8 (Bug #8685).

http://git.horde.org/diff.php/framework/Rpc/lib/Horde/Rpc/Jsonrpc.php?rt=horde-git&amp;r1=bfbf37ce80786f3a0d6c904509cc27d53698dd52&amp;r2=bff9b6b204d6dac17d167c8aae9a64791c5535fd</description> 
   <pubDate>Sat, 07 Nov 2009 17:47:32 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56573</link> 
  </item> 
   
  <item> 
   <title>&gt; Changes have been made in CVS for this ticket:
&gt;
&gt; JSON </title> 
   <description>&gt; Changes have been made in CVS for this ticket:
&gt;
&gt; JSON is always UTF-8 (Bug #8685).
&gt; http://cvs.horde.org/diff.php/framework/RPC/RPC/Attic/jsonrpc.php?rt=horde&amp;r1=1.4.2.4&amp;r2=1.4.2.5&amp;ty=u

this breaks the json request.
--&gt; Horde_NLS::setCharsetEnvironment(&#039;UTF-8&#039;);</description> 
   <pubDate>Sat, 07 Nov 2009 19:53:37 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56574</link> 
  </item> 
   
  <item> 
   <title>&gt; this breaks the json request.

Care to tell us how?</title> 
   <description>&gt; this breaks the json request.

Care to tell us how?</description> 
   <pubDate>Sun, 08 Nov 2009 10:38:13 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56577</link> 
  </item> 
   
  <item> 
   <title>&gt;&gt; this breaks the json request.
&gt;
&gt; Care to tell us how?</title> 
   <description>&gt;&gt; this breaks the json request.
&gt;
&gt; Care to tell us how?
under investigation.... right now...

I let you know as soon as i know more...
</description> 
   <pubDate>Sun, 08 Nov 2009 10:44:25 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56578</link> 
  </item> 
   
  <item> 
   <title>&gt;&gt;&gt; this breaks the json request.
&gt;&gt;
&gt;&gt; Care to tell us ho</title> 
   <description>&gt;&gt;&gt; this breaks the json request.
&gt;&gt;
&gt;&gt; Care to tell us how?
[09-Nov-2009 11:06:04] PHP Fatal error:  Class &#039;Horde_NLS&#039; not found in /horde3/lib/Horde/RPC/jsonrpc.php on line 44
</description> 
   <pubDate>Mon, 09 Nov 2009 10:14:32 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56583</link> 
  </item> 
   
  <item> 
   <title>framework/RPC/RPC/jsonrpc.php,v 1.4.2.4 2009/01/06 15:23:32 </title> 
   <description>framework/RPC/RPC/jsonrpc.php,v 1.4.2.4 2009/01/06 15:23:32 

Line 91 
+ return Horde_Serialize::serialize($response, SERIALIZE_JSON, NLS::getCharset());
- return Horde_Serialize::serialize($response, SERIALIZE_JSON);

Works for me. </description> 
   <pubDate>Mon, 09 Nov 2009 10:43:19 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56584</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

Fix class na</title> 
   <description>Changes have been made in CVS for this ticket:

Fix class name (Bug #8685).
http://cvs.horde.org/diff.php/framework/RPC/RPC/Attic/jsonrpc.php?rt=horde&amp;r1=1.4.2.5&amp;r2=1.4.2.6&amp;ty=u</description> 
   <pubDate>Mon, 09 Nov 2009 13:20:21 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56586</link> 
  </item> 
   
  <item> 
   <title>How about now?

&gt; Line 91
&gt; + return Horde_Serialize::ser</title> 
   <description>How about now?

&gt; Line 91
&gt; + return Horde_Serialize::serialize($response, SERIALIZE_JSON, 
&gt; NLS::getCharset());
&gt; - return Horde_Serialize::serialize($response, SERIALIZE_JSON);

There is no such line.</description> 
   <pubDate>Mon, 09 Nov 2009 13:21:13 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56587</link> 
  </item> 
   
  <item> 
   <title>&gt; How about now?
&gt;
&gt;&gt; Line 91
&gt;&gt; + return Horde_Serialize</title> 
   <description>&gt; How about now?
&gt;
&gt;&gt; Line 91
&gt;&gt; + return Horde_Serialize::serialize($response, SERIALIZE_JSON,
&gt;&gt; NLS::getCharset());
&gt;&gt; - return Horde_Serialize::serialize($response, SERIALIZE_JSON);
&gt;
&gt; There is no such line.

Jsonrpc.php, which is delivered 2009-09-14: Horde Groupware 1.2.4:

Might be this one:
http://cvs.horde.org/h/chora/annotate.php/framework/RPC/RPC/Attic/jsonrpc.php?sa=1&amp;rev=1.5



</description> 
   <pubDate>Mon, 09 Nov 2009 13:40:01 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56591</link> 
  </item> 
   
  <item> 
   <title>&gt; Changes have been made in CVS for this ticket:
&gt;
&gt; Fix c</title> 
   <description>&gt; Changes have been made in CVS for this ticket:
&gt;
&gt; Fix class name (Bug #8685).
&gt; http://cvs.horde.org/diff.php/framework/RPC/RPC/Attic/jsonrpc.php?rt=horde&amp;r1=1.4.2.5&amp;r2=1.4.2.6&amp;ty=u

This does not change the charsetcoding of strings in $response.
@return string  The JSON encoded response from the server. 

Still the same behavior for me.</description> 
   <pubDate>Mon, 09 Nov 2009 13:59:17 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56592</link> 
  </item> 
   
  <item> 
   <title>Please download a fresh copy of this file, revision 1.4.2.6.</title> 
   <description>Please download a fresh copy of this file, revision 1.4.2.6. You might still have local modifications that interfere.</description> 
   <pubDate>Mon, 09 Nov 2009 14:14:07 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56593</link> 
  </item> 
   
  <item> 
   <title>&gt; Please download a fresh copy of this file, revision 1.4.2.</title> 
   <description>&gt; Please download a fresh copy of this file, revision 1.4.2.6. You 
&gt; might still have local modifications that interfere.
Still no luck. Strings get cut off.  $response is still in ISO-8859-1 
Will do a fresh install.  Hope that helps.




</description> 
   <pubDate>Mon, 09 Nov 2009 14:33:54 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56594</link> 
  </item> 
   
  <item> 
   <title>&gt; In Horde 3.3.5 the response object from Kronolith is using</title> 
   <description>&gt; In Horde 3.3.5 the response object from Kronolith is using wrong charset.
&gt;
&gt; If Horde API is used to Power External Sites like this one:
&gt; http://theupstairsroom.com/67
&gt;
&gt; Problem:
&gt; Strings get cut off
&gt;
&gt; Reason:
&gt; kronolith/lib/Driver/sql.php (line 453)
&gt; Kronolith_Event_sql turns all utf8 strings into 
&gt; $GLOBALS[&#039;_HORDE_STRING_CHARSET&#039;] = &#039;iso-8859-1&#039;;

I can confirm this solution (thanks to Roman too). It solves the described problem for me (had that problems with strings containing german &#039;umlauts&#039;) - 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</description> 
   <pubDate>Mon, 09 Nov 2009 16:13:31 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56598</link> 
  </item> 
   
  <item> 
   <title>I can see clearly now what the patch of Jan is trying to do.</title> 
   <description>I can see clearly now what the patch of Jan is trying to do. :-)

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 &quot;bug&quot;. 
(in NLS.php)

the NLS::setLang(); turns the charset back to iso,
before the utf-8 can take action.

Regards roman</description> 
   <pubDate>Mon, 09 Nov 2009 17:12:11 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t56600</link> 
  </item> 
   
  <item> 
   <title>&gt; the NLS::setLang(); turns the charset back to iso,
&gt; befo</title> 
   <description>&gt; the NLS::setLang(); turns the charset back to iso,
&gt; before the utf-8 can take action.

Only if your system locales don&#039;t support UTF-8. Install UTF-8 locales.</description> 
   <pubDate>Sat, 10 Apr 2010 12:30:11 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t58443</link> 
  </item> 
   
  <item> 
   <title>&gt;&gt; the NLS::setLang(); turns the charset back to iso,
&gt;&gt; be</title> 
   <description>&gt;&gt; the NLS::setLang(); turns the charset back to iso,
&gt;&gt; before the utf-8 can take action.
&gt;
&gt; Only if your system locales don&#039;t support UTF-8. Install UTF-8 locales.
there was a problem with the test environment client server on the 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.</description> 
   <pubDate>Sat, 10 Apr 2010 12:51:19 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/8685#t58444</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
