I've had problems with encoding : non-ASCII characters in events were not encoded correctly on the receiving side. After some investigation, I think there's a problem in the ApacheHttpClientAdapter (in com.snowplowanalytics.snowplow.tracker.http):
public int doPost(String url, String payload) {
try {
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", Constants.POST_CONTENT_TYPE);
StringEntity params = new StringEntity(payload);
httpPost.setEntity(params);
where Constants.POST_CONTENT_TYPE is "application/json; charset=utf-8"
I did some checking in the Apache HTTP Client. When an entity is defined passing only a String (such as here: new StringEntity(payload)), the default encoding used to convert the String into a bytes array is ISO-8859-1, which contradicts the Content-Type header.
I'll do a PR later today.
I've had problems with encoding : non-ASCII characters in events were not encoded correctly on the receiving side. After some investigation, I think there's a problem in the ApacheHttpClientAdapter (in
com.snowplowanalytics.snowplow.tracker.http):where
Constants.POST_CONTENT_TYPEis"application/json; charset=utf-8"I did some checking in the Apache HTTP Client. When an entity is defined passing only a String (such as here:
new StringEntity(payload)), the default encoding used to convert the String into a bytes array is ISO-8859-1, which contradicts theContent-Typeheader.I'll do a PR later today.