Set response encoding with HttpClient 3.1

前端 未结 4 649
甜味超标
甜味超标 2021-01-14 14:32

I\'m using org.apache.commons.httpclient.HttpClient and need to setup response encoding (for some reason server returns incorrect encoding in Content-Type). My

4条回答
  •  抹茶落季
    2021-01-14 15:14

    Greetings folks,

    Jus in case someone finds this post googling for setting HttpClient to write in UTF-8.

    This line of code should be handy...

    response.setContentType("text/html; charset=UTF-8");
    

    Best

提交回复
热议问题