GSON not sending in UTF-8

前端 未结 3 726
心在旅途
心在旅途 2021-02-08 17:10

The following method sends a JSON reply. However on the receiving end I keep getting invalid characters, and UTF-8 isn\'t decoding the data. What am I doing wrong?

3条回答
  •  情深已故
    2021-02-08 18:08

    The first solution didn't work for me, I did this:

    Gson gson = new GsonBuilder().disableHtmlEscaping().create();
    String json = gson.toJson(objectToEncode);
    

提交回复
热议问题