mixpanel / mixpanel-java

Other
49 stars 37 forks source link

Import of data failed when sending special chars (umlaute) #7

Closed sternwald closed 10 years ago

sternwald commented 10 years ago

When sending special chars (umlaute like öäü) during a data import the server returns com.mixpanel.mixpanelapi.MixpanelServerException: Server refused to accept messages, they may be malformed.

The problem is solved by using the method getBytes("utf-8") in the Base64Coder instead of getBytes().

getBytes() encodes the json string with the default char set which is not necessarily utf-8. see http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#getBytes%28%29

TODO: check if there are side effects in other uses of the method encodeString

joeatwork commented 10 years ago

Thanks for submitting this request! Unfortunately, our dev machines here default to UTF8 encoding, so I'm having trouble reproducing the problem. I've pushed a proposed fix to a branch ( https://github.com/mixpanel/mixpanel-java/tree/rc1.2.1 ) - if you could confirm that that branch fixes your issues, I'll merge it into the main line of development for future release.

Thanks again for your contribution!

sternwald commented 10 years ago

Confirmed: On Mac OSX using master i get the MixpanelServerException when there is a property value containing ü and ä. On branch rc1.2.1 it‘s gone.

joeatwork commented 10 years ago

Excellent! Thank you so much!

joeatwork commented 10 years ago

I've included the changes in release 1.2.1, which should show up in Maven central in a few hours. Thanks again for your help!