ZF-6777: Is it completely necessary to encode UTF-8 to \uXXXX during JSON encoding, while JSON standart allows pure unicode strings and (all?) browsers supports them?
I'm not sure, this is a valid feature request, but I've spent almost a half day googling and failed to find an answer. If I am right, it would be very nice, if some one adds an easy and small option to Zend_Json_Encode to make this feature work.
So. As I understand, the JSON standard (json.org) allows a string to consist of unicode characters. Though, it looks like the standard doesn't specify exact unicode encoding type, it is normal (from my point of view) to expect, that during browser-server data transmissions (I think, it is a huge (if not the largest) class of JSON use-cases) "unicode" means utf-8, because it is common today for both sides (browser and server software) to provide a full utf-8 string-support.
If it is true, then why an UTF-8 strings gets encoded to an ugly bloated \uXXXX encoding, while both sides (client-side browser and server) support a normal utf-8 strings?
PHPs native function json_encode() produces \uXXXX by default and there is no way to alter this behavior. Till ZF1.8 Zend_Json_Encoder didn't mangle utf-8 and produced a normal result, but since 1.8 (or 1.8.1? I didn't catch that) it also makes a bloated \uXXXX strings :(
What are the benefits of 3-times bloated and very slow \uXXXX encoding over a plain small-simple-fast utf-8? Is \uXXXX encoding absolutely necessary to send data from an utf-8 php script to a "modern" browser (like ff2-3, ie 6-7, or Opera9.64 - I tested them all with an old-style Zend_Json_Encoder) ?
If it isn't necessary, can somebody add a small option to Zend_Json_Encoder class to leave Utf-8 as it is, without converting to \uXXXX? The question is related to ZF-4054, if its effect could be reverted.
Thanks for an answers...