[
https://issues.apache.org/jira/browse/HTTPCORE-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15462757#comment-15462757
]
ASF GitHub Bot commented on HTTPCORE-431:
-----------------------------------------
Github user hirthwork commented on the issue:
https://github.com/apache/httpcore/pull/30
> To be clear, the performance penalty you're thinking of is a string
comparison of the MIME type?
I'm talking about single bytes reading and input streams concatenation.
Also, what will happen for empty responses? This code will return non-empty
string, which is incorrect. Same for some single byte responses.
I completely agree with you, that ContentType.parse("application/json")
should return ContentType.APPLICATION_JSON.
But it is appropriate to introduce this changes only in ContentType class,
leaving other classes untouched.
This will perfectly match statement concerning [default
encoding](https://tools.ietf.org/html/rfc7159#section-8.1)
> Correct character encoding default for application/json
> -------------------------------------------------------
>
> Key: HTTPCORE-431
> URL: https://issues.apache.org/jira/browse/HTTPCORE-431
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Components: HttpCore
> Reporter: Paul Draper
> Priority: Minor
>
> RFC 4627 and RFC 7159 require that parsers auto-detect the encoding of
> application/json. UTF-8 is the suggested default, though it's possible to
> detect the encoding of valid JSON unambiguously.
> Currently, EntityUtils.toString defaults to ISO-8859-1 (the default for text
> formats without a charset parameter).
> Given how common application/json is, it would be great for
> EntityUtils.toString to use the correct encoding.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]