Issues

ZF-4054: UTF8 character encoding for Zend_Json_Encoder

Description

Zend_Json_Encoder does not support encoding of UTF8 characters.


Zend_Json_Encoder::encode('Отладочный')

yields


"Отладочный"

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


"\u041e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0439"

Comments

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.

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

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

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

I'll look into it.

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).

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

quick fix

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

worked for me

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