php-rest-service icon indicating copy to clipboard operation
php-rest-service copied to clipboard

JSON output: please add right encoding

Open gubi opened this issue 7 years ago • 1 comments

I encountered a problem with the json output: accented vowels and apostrophes were parsed as "\u00e0" or "\u2019". I solved simply by adding the native php json_encode() suffix JSON_FORCE_OBJECT|JSON_UNESCAPED_UNICODE in

https://github.com/marcj/php-rest-service/blob/3263cd29881574077ec8f7f849713f4a59e4a37f/RestService/Client.php#L251

like this:

if (!is_string($json)) $json = json_encode($json, JSON_FORCE_OBJECT|JSON_UNESCAPED_UNICODE);

Please integrate it in your code ;)

gubi avatar Jan 08 '18 23:01 gubi

Please provide a pull-request, so I can merge.

marcj avatar Mar 06 '19 14:03 marcj