문제

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();
도움이 되었습니까?

해결책 2

Try

Request.setHeader(CoreProtocolPNames.HTTP_CONTENT_CHARSET, Consts.UTF_8);

다른 팁

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();    
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top