Issues

ZF-4054: UTF8 character encoding for Zend_Json_Encoder

Issue Type: Improvement Created: 2008-08-24T15:48:57.000+0000 Last Updated: 2009-03-20T07:52:02.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Christoph Dorn (cadorn) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Json

Related issues: - ZF-3395

Attachments:

Description

Zend_Json_Encoder does not support encoding of UTF8 characters.

<pre class="highlight">
Zend_Json_Encoder::encode('Отладочный')

yields

<pre class="highlight">
"Отладочный"

instead of the following which is generated with json_encode() which does support UTF8 characters

<pre class="highlight">
"\u041e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0439"

Comments

Posted by Christoph Dorn (cadorn) on 2008-09-23T09:21:18.000+0000

FYI: I am using this library for JSON encoding and it works great for UTF-8 characters.

http://pear.php.net/pepr/pepr-proposal-show.php/…

It is licensed under BSD.

Would it be possible to contact the authors to see if they can contribute the code to ZF or do you have other plans on how to incorporate UTF-8 encoding?

This is becoming an increasingly important issue for the FirePHP integration as well as international ZF userbase that uses AJAX.

Posted by Benjamin Eberlei (beberlei) on 2009-01-13T07:40:00.000+0000

The JSON Spec does not require unicode characters to be in ASCII Sequences

Posted by Christoph Dorn (cadorn) on 2009-01-13T10:04:32.000+0000

The question then is; do we try and produce the same output as json_encode()?

Posted by Benjamin Eberlei (beberlei) on 2009-01-13T10:12:17.000+0000

i guess we should, and matthew had the same opinion on that.

I'll look into it.

Posted by Benjamin Eberlei (beberlei) on 2009-01-15T15:22:34.000+0000

The incubator now holds a version of Zend_Json that has unicode transformation for both encoding and decoding making it consistant with json_encode()/json_decode()

Please test this with your use-cases (make sure to set the internal encoder decoder = true).

Posted by Christoph Dorn (cadorn) on 2009-01-18T20:21:02.000+0000

Works like a charm. All my tests are still passing.

Posted by clive darr (osde8info) on 2009-03-04T09:30:29.000+0000

quick fix

$ svn co http://framework.zend.com/svn/framework/…

worked for me

Posted by Benjamin Eberlei (beberlei) on 2009-03-20T07:52:02.000+0000

Moved from incubator to trunk in r14399, scheduled for 1.8 release

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts