hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCORE-431) Correct character encoding default for application/json
Date Sat, 03 Sep 2016 19:14:20 GMT

    [ https://issues.apache.org/jira/browse/HTTPCORE-431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15461555#comment-15461555
] 

ASF GitHub Bot commented on HTTPCORE-431:
-----------------------------------------

Github user pauldraper commented on the issue:

    https://github.com/apache/httpcore/pull/30
  
    > This code makes no distinction between BE and LE encodings described in rfc4627.
    > rfc7159 explicitly forbids byte order marks, while this patch depends on BOMs.
    
    RFC 7159 disallows UTF-16BE, UTF-16LE, UTF-32BE and UTF-32LE.
    
    > JSON text SHALL be encoded in UTF-8, UTF-16, or UTF-32. 
    
    This code works for these three encodings.
    
    I agree, however, that this code should work for RFC 4627 which permitted the BE/LE encodings.
    
    > IMHO, workarounds for improper servers should not be injected in core functionality.
    
    I don't see how this is a "workaround" for improper servers. This project follows RFC
2616 when decoding entities. I suggest that it also follow RFC 4627/7159.
    
    > Probably, separate function like EntityUtils.safeJsonToString(...) should be introduced,
so anybody using this function will be informed than slight performance penalty will apply.
    
    To be clear, the performance penalty you're thinking of is a string comparison of the
MIME type?


> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message