On 02/04/14 12:29, Sergey Beryozkin wrote:
On 02/04/14 11:52, Jose María Zaragoza wrote:
2014-04-02 12:32 GMT+02:00 Sergey Beryozkin <[email protected]>:
I'm going to check headers ( Content-Type really )
Content-Type:application/json means payload is encoded with ISO-8859-1
I've seen that you use
String enc = HttpUtils.getEncoding(mt, "UTF-8");
but the default value, according HTTP spec , should be ISO-8859-1
well, it is not that simple, I guess ISO-8859-1 was treated as a default
because when HTML 1.0 was created many years ago the question of
supporting
all sort of languages was not a high priority; and again when we deal
with
JSON we may say that that defaulting to ISO-8859-1 is wrong as per
the JSON
spec
Well, I don't agree, because if you use MediaType ( HTTP header ) to
retrieve encoding, you must follow HTTP spec
No, it is not that simple. Besides this text:
"The "charset" parameter is used with some media types to define the
character set (section 3.4) of the data. When no explicit charset
parameter is provided by the sender, media subtypes of the "text" type
are defined to have a default charset value of "ISO-8859-1" when
received via HTTP"
seems very outdated, applies to text/* only, seems to be talking about
the senders only and is not available in HTTPBIS specs (I can't see it
at least), it does not make sense to implement it
Specifically see
http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-3.1.1.1
and then follow to Accept.
Even we say that HTTP 2.0 has not been released, we can still be sure
that text/* is not related to application/json
Thanks, Sergey
Sergey
Anyway, with your permission, I going to make a local fork of
JSONProvider.java . Indeed, default encoding could be a good candidate
to be a set property
Thanks and regards
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com