Javed Bhayla created HTTPCLIENT-2224:
----------------------------------------

             Summary: US_ASCII used instead of charset configuration in 
CharCodingConfig
                 Key: HTTPCLIENT-2224
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2224
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (async)
    Affects Versions: 5.1.3
         Environment: Running on MacOS, EC2
            Reporter: Javed Bhayla


Issue: “supplémentaires sur l'état relative à” shows up as “suppl��mentaires 
sur l'��tat relative ��” in the JSON response

I have configured the async client to use UTF_8 using:

CloseableHttpAsyncClient client = HttpAsyncClients.custom()
.setCharCodingConfig(CharCodingConfig.custom().setCharset(UTF_8).build())
.build()

Making a request and calling “response.getBodyText()” results in US_ASCII being 
used instead of UTF_8 because the server returns the header “Content-Type: 
application/json” without the charset.

If the server returns "Content-Type: application/json;charset=utf-8", then 
UTF-8 is used as expected.

Should the CharCodingConfig setting be used as the default instead of US_ASCII 
in SimpleBody?



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to