Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

add support of JSON_UNESCAPED_UNICODE #7458

Closed
wants to merge 2 commits into from
Closed

add support of JSON_UNESCAPED_UNICODE #7458

wants to merge 2 commits into from

Conversation

rznzippy
Copy link

add unescapedUnicode option to Zend\Json::encode #6848 #7206

@rznzippy rznzippy changed the title #6848 add support of JSON_UNESCAPED_UNICODE add support of JSON_UNESCAPED_UNICODE Apr 23, 2015
@Ocramius
Copy link
Member

While I understand why this was implemented, I don't see an actual use-case.

What is it for, exactly? Seems like an un-needed security risk to me...

@rznzippy
Copy link
Author

Hello Marco,

First of all I'ld like to say thank you for your time.

We're using this option for two reasons:

  • we have integration with android application that unable to recognise encoded unicode characters
  • with this option we could put human-readable request/response text to text log files

For now we have to have our own implementation of Json and JsonModel classes, because there is no easy way to pass JSON_UNESCAPED_UNICODE option into json_encode function inside Json class.

So main pros that I can see:

  • be able to integrate with some applications that doesn't support encoded unicode characters
  • human-readable output in console and log files
  • reduced size of json string

@weierophinney
Copy link
Member

I agree with @Ocramius that this is a security risk. As such, you're already following the appropriate course of action, @rznzippy : extending and overriding the renderer and model present in the framework. (This is why we have an IoC container and configurable renderers!)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants