Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-328

EntityUtils#toString ignores default charset parameter if there is no ContentType in the http response

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.3
    • Fix Version/s: 4.2.4, 4.3-beta1
    • Component/s: HttpCore
    • Environment:
      Eclipse 3.7 SR2
      Oracle Java EE 1.6.0
      Windows XP SP3

      Description

      There is a http response with 500 status and error message encoded in UTF-8 in ContentBody, but without ContentType header.
      When using EntityUtils.toString to get message like:
      EntityUtils.toString(response.getEntity(), "UTF-8")
      the defaultCharset will never work.

      The real charset becomes ISO_8859_1 because ContentType.getOrDefault(entity) will return a ContentType holding a never null charset(ISO_8859_1). It can not be overrided by defaultCharset anymore.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                kuyurmoe kuyurmoe
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: