mixpanel-js icon indicating copy to clipboard operation
mixpanel-js copied to clipboard

JSON Encoder breaks unicode characters on emojis 🌳

Open 1oglop1 opened this issue 1 year ago • 1 comments

Hi, I'm working on Mixpanel proxy for further analytics and my code is failing to reconstruct input data which contain UTF-8 emojis.

I suspect the root cause is the custom JSON Encoder https://github.com/mixpanel/mixpanel-js/blob/8ac526e5cb8563d11e2206046ab986c6491ac6d7/src/utils.js#L393-L416

which corrupts unicode characters Input

{"event": "🌳"}

Expected output:

{\"event\": \"\xf0\x9f\x8c\xb3\"}

actual SDK output:

{\"event\": \"\xed\xa0\xbc\xed\xbc\xb3\"}

1oglop1 avatar Aug 09 '23 06:08 1oglop1