Request.config(CoreProtocolPNames.HTTP_CONTENT_CHARSET, Consts.UTF_8)
and Request.elementCharset(charset)
are Deprecated.
Now how to set the request charset to utf-8 with fluent?
Request.Post(url)
.useExpectContinue()
.version(HttpVersion.HTTP_1_1)
.bodyString("Important stuff", ContentType.DEFAULT_TEXT)
.execute().returnContent().asBytes();
That would be the right way doing it
Request.Post("someurl")
.useExpectContinue()
.version(HttpVersion.HTTP_1_1)
.bodyString("Important stuff", ContentType.create("text/plain", Consts.UTF_8))
.execute()
.returnContent().asBytes();
尝试
Request.setHeader(CoreProtocolPNames.HTTP_CONTENT_CHARSET, Consts.UTF_8);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.