application icon indicating copy to clipboard operation
application copied to clipboard

JsonResponse: escape unicode

Open milo opened this issue 7 years ago • 0 comments

Version: dev (73742cf42111d3af7468fd8ae8e1dd11dd7a2c31)

Bug Description

JsonRespose uses Json::encode(). It has default flag JSON_UNESCAPED_UNICODE set.

For example, encoding result of ["Předměty"] is:

["Předměty"]

When I decode such data in PowerShell (v5.1 on Windows Server 2012):

$json = Invoke-WebRequest 'http://localhost/export/students-in-courses'
$data = $json | ConvertFrom-Json

I get malformed output like P??edm??ty.

Without mentioned flag, json looks like followed and decoding is fine:

["P\u0159edm\u011bty"]

Honestly, I don't know much about JSON standard, so I don't know how problematic BC break it is. And maybe it is an issue of PowerShell at all, I didn't find any relevant info.

As a workaround I use CallbackResponse and own JSON encoding.

milo avatar May 31 '18 16:05 milo