jira-importer opened a new issue, #964: URL: https://github.com/apache/httpcomponents-core/issues/964
**[Thomas Kruse](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=everflux)** opened **[HTTPCORE-329](https://issues.apache.org/jira/browse/HTTPCORE-329?redirect=false)** and commented The method public static String toString( final HttpEntity entity, final String defaultCharset) delegates to public static String toString( final HttpEntity entity, final Charset defaultCharset) { ... ContentType contentType = ContentType.getOrDefault(entity); Charset charset = contentType.getCharset(); if (charset == null) { charset = defaultCharset; } ... } This method uses a default content type which has a charset set(!) public static ContentType getOrDefault(final HttpEntity entity) throws ParseException { ContentType contentType = get(entity); return contentType != null ? contentType : DEFAULT_TEXT; } public static final ContentType DEFAULT_TEXT = TEXT_PLAIN; public static final ContentType TEXT_PLAIN = create( "text/plain", Consts.ISO_8859_1); This leads to the situation that the defaultCharset is not used but latin1 encoding from the default content type. The default content type should not have an encoding set to prevent this. --- **Affects:** 4.2.1 **Issue Links:** - [HTTPCORE-328](https://issues.apache.org/jira/browse/HTTPCORE-328) EntityUtils#toString ignores default charset parameter if there is no ContentType in the http response (_**"duplicates"**_) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
