Closed Wanjuuuuu closed 3 years ago
This problem takes me a whole afternoon to find out where make it authorization error.
This should really be fixed, but I have to admit that it worries me how many repercussions it might have for all projects currently using retrofit with GsonConverterFactory.create() to have an update at some point suddenly start escaping html characters when they are not used to having that happen because of this bug...
Of course, any sane json parser on the other end won't care either way, but you never know what brain-dead or broken parsers might exist on the other end.
But yeah, just a long way of saying, I really think this should be fixed, but I'm almost afraid to ask.
Hi, can you fix it?
Hi,
while working on my project with Retrofit, I found an issue with
newJsonWriter
method in Gson class.I used
GsonConverterFactory
which is a wrapper class of Gson in Retrofit.Gson enables to escape HTML characters as a default.
However, Retrofit doesn't encode the request body as the same as Gson does.
Here is GsonConverterFactory code from Retrofit. I can see there is no any other options it gives to gson.
As above, it uses
gson.newJsonWriter(writer)
.I look through
newJsonWriter
, but it does not apparently configure whole settings from Gson.For example, it is
HtmlSafe
option in my case.I guess HtmlSafe is garanteed as true in Gson, though, it can be false in JsonWriter when not using `setHtmlSafe(true)'.
Could you check this issue?