salesforce-marketingcloud / SFDC-MC-REST-Style-Guide

REST style guidelines
31 stars 9 forks source link

charset=utf-8 #6

Closed jfitzgeraldSF closed 9 years ago

jfitzgeraldSF commented 9 years ago

Should we be explicit and change content-type (request and response) to include a charset (i.e application/json; charset=utf-8)

From what I've read, it shouldn't be necessary: "JSON text SHALL be encoded in Unicode. The default encoding is UTF-8." And yet, I've had at least one internal app log a bug because the library they used to unmarshall the response did not treat the response as utf8.

Will ET ever return something other than utf-8? @dougwilson

aroden-salesforce commented 9 years ago

I don't think we will faulter off of UTF-8. I changed the current API to "application/json; charset=utf-8" a while back.

Technically JSON is valid with UTF-16, but to your point who cares.

dougwilson commented 9 years ago

I think @jftz 's point is valid, of course. We want all our APIs to specifically respond with Content-Type: application/json; charset=UTF-8 which is also necessary for older Chrome, otherwise it interprets as ISO-8859-1.

Technically according to spec (which, I should note, came out after application/json was already widely used, which is one of the problems) application/json == application/json; charset=UTF-8.

jfitzgeraldSF commented 9 years ago

i updated the content-types to include the charset. closing this unless someone wants to revert the commit.