What exactly returns EntityUtils.toString(response)?

前端 未结 2 2036
南旧
南旧 2021-01-06 17:35

I\'m doing my API REST and I saw that in a lot of examples people use EntityUtils.toString(response) to get their response into a String

2条回答
  •  猫巷女王i
    2021-01-06 17:43

    Beware the default charset of EntityUtils.toString:

    Get the entity content as a String, using the provided default character set if none is found in the entity. If defaultCharset is null, the default "ISO-8859-1" is used.

    org.apache.http.util.EntityUtils.toString(response.getEntity, "UTF-8");

提交回复
热议问题