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
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