Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1667

RequestBuilder ignores Charset

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.5
    • 5.0 Alpha1
    • HttpClient (classic)
    • None

    Description

      Sorry for my English.

      Class org.apache.http.client.methods.RequestBuilder in method build() FORCE to use ISO-8859-1 encoding

      For example my using:

      HttpUriRequest post = RequestBuilder.post().setUri(url)
      	.setCharset(Charset.forName("Windows-1251"))
      	.addParameter("xml", xml).build();
      

      QuickFix (line ~481):

                  if (entityCopy == null && (HttpPost.METHOD_NAME.equalsIgnoreCase(method)
                          || HttpPut.METHOD_NAME.equalsIgnoreCase(method))) {
      --                entityCopy = new UrlEncodedFormEntity(parameters, HTTP.DEF_CONTENT_CHARSET);
      ++                entityCopy = new UrlEncodedFormEntity(parameters, charset != null ? charset : HTTP.DEF_CONTENT_CHARSET);
      

      I think it also may to be changed in other places in class.

      Attachments

        Activity

          People

            Unassigned Unassigned
            smithsv Sergey Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: