MultipartEntityBuilder and Charset

后端 未结 5 1222
深忆病人
深忆病人 2020-12-09 09:21

I upgraded my httpmime package, and now my strings are not sent or received as UTF-8

MultipartEntityBuilder entity = MultipartEntityBuilder.create();
Charset         


        
5条回答
  •  旧时难觅i
    2020-12-09 09:48

    In my case, I setup the contentType first like this

    ContentType contentType = ContentType.create(
                            HTTP.PLAIN_TEXT_TYPE, HTTP.UTF_8);
    

    and when adding pairs , specify the content type like this

    entityBuilder.addTextBody("title",pic.getTitle(),contentType);
    

    as answered here MultipartEntityBuilder and setCharset for UTF-8 sends empty content

提交回复
热议问题