frellan
03/03/2023, 2:07 PMContent-Type: application/json
header instead of the Content-Type: application/json; charset=UTF-8
which it had before. This causes my flutter app to display the wrong characters since it decodes everything all wrong. How do I fix this? Why is this change not documented? My entire API is broken.Sam
03/03/2023, 2:17 PMapplication/json; charset=UTF-8
isn’t a valid content type header. See also https://youtrack.jetbrains.com/issue/KTOR-3799frellan
03/03/2023, 2:19 PMSam
03/03/2023, 2:19 PMfrellan
03/03/2023, 2:24 PMconvert.jsonDecode(utf8.decode(**))
on every single thing instead of
jsonDecode(**)
Like, really?Sam
03/03/2023, 2:32 PMconvert.jsonDecode
takes a String, which has already been decoded (using, potentially, the wrong encoding). Ideally there would be a method that takes the bytes and decodes them directly to JSON, without needing to go via a String.frellan
03/03/2023, 2:33 PMSam
03/03/2023, 2:39 PMWhen no explicit charset parameter is provided by the sender, media subtypes of the “text” type are defined to have a default charset value of “ISO-8859-1"which is not only obsolete but also specifically doesn’t apply to application/json. That said, it’s a reasonable default if the user specifically wants to get the body as a String.
bodyBytes
directly to a JSON decoder of some kind? That might avoid the problem.frellan
03/03/2023, 2:41 PMjsonDecode(utf8.decode(response.bodyBytes))
solves it for me