ploner / RMixpanel

RMixpanel - Mixpanel API client package for R
Other
18 stars 6 forks source link

Error: lexical error: invalid character inside string. #2

Closed jzking closed 6 years ago

jzking commented 7 years ago

Seems to be an issue supporting non ASCII chars or escape strings inside of results from Mixpanel. Error probably originates from RCURL or jsonlite. Source has around 64,000 results with a mix of English and extended characters from Asian languages.

ploner commented 7 years ago

Hi @jzking thanks for pointing to this issue. Did you have a workaround in the meanwhile? Honestly, I never encountered the problem - the client data I analyzed was mostly from US-EU.

jzking commented 7 years ago

I forked it and added an option to specify encoding when calling the get events function. I haven't confirmed that it works yet but I will let you know. Maybe we can merge them or something.

Sent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: Meinhard Ploner notifications@github.com Date: 9/18/17 4:47 PM (GMT+01:00) To: ploner/RMixpanel RMixpanel@noreply.github.com Cc: jzking josephzking@yahoo.com, Mention mention@noreply.github.com Subject: Re: [ploner/RMixpanel] Error: lexical error: invalid character inside string. (#2) Hi @jzking thanks for pointing to this issue. Did you have a workaround in the meanwhile? Honestly, I never encountered the problem - the client data I analyzed was mostly from US-EU.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/ploner/RMixpanel","title":"ploner/RMixpanel","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/ploner/RMixpanel"}},"updates":{"snippets":[{"icon":"PERSON","message":"@ploner in #2: Hi @jzking thanks for pointing to this issue. Did you have a workaround in the meanwhile? Honestly, I never encountered the problem - the client data I analyzed was mostly from US-EU."}],"action":{"name":"View Issue","url":"https://github.com/ploner/RMixpanel/issues/2#issuecomment-330246927"}}}

ploner commented 7 years ago

Yes, if it works the code should be integrated in the main project. Let me know

christerwi commented 6 years ago

was this resolved? on version RMixpanel_0.6-3 we are running into errors with french characters:

Error: lexical error: invalid character inside string.
          brand":"samsung","$carrier":"fOrange","$city":"Fort-de-Fran
                     (right here) ------^

it looks like jsonlite has become less accommodating towards improper json; forcing jsonlite back to version 0.9.12 usually works, but we'd prefer to not do that (other limitations). Reference: jsonlite issue 47

ploner commented 6 years ago

I forked it and added an option to specify encoding when calling the get events function. I haven't confirmed that it works yet but I will let you know. Maybe we can merge them or something. Sent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: Meinhard Ploner notifications@github.com Date: 9/18/17 4:47 PM (GMT+01:00) To: ploner/RMixpanel RMixpanel@noreply.github.com Cc: jzking josephzking@yahoo.com, Mention mention@noreply.github.com Subject: Re: [ploner/RMixpanel] Error: lexical error: invalid character inside string. (#2) Hi @jzking thanks for pointing to this issue. Did you have a workaround in the meanwhile? Honestly, I never encountered the problem - the client data I analyzed was mostly from US-EU. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/ploner/RMixpanel","title":"ploner/RMixpanel","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"[https://github.com/ploner/RMixpanel"}},"updates":{"snippets":[{"icon":"PERSON","message":"@ploner](https://github.com/ploner/RMixpanel%22%7D%7D,%22updates%22:%7B%22snippets%22:%5B%7B%22icon%22:%22PERSON%22,%22message%22:%22@ploner) in #2: Hi @jzking thanks for pointing to this issue. Did you have a workaround in the meanwhile? Honestly, I never encountered the problem - the client data I analyzed was mostly from US-EU."}],"action":{"name":"View Issue","url":"#2 (comment)"}}}

Hi, I added the encoding parameter as suggested by you in version 0.7-0. I am not able to test it but I think it looks good. Thanks a lot! M

ploner commented 6 years ago

was this resolved? on version RMixpanel_0.6-3 we are running into errors with french characters:

Error: lexical error: invalid character inside string.
          brand":"samsung","$carrier":"fOrange","$city":"Fort-de-Fran
                     (right here) ------^

it looks like jsonlite has become less accommodating towards improper json; forcing jsonlite back to version 0.9.12 usually works, but we'd prefer to not do that (other limitations). Reference: jsonlite issue 47

Hi Christer, I uploaded an updated version (0.7-0) where you can specify the encoding - at least for the R methods which download raw event data, as well as the main function mixpanelGetData. I am not able to test this change because I have no broken data in my Mixpanel accounts. If you could give it a try and gimme feedback it would be great! Thx

christerwi commented 6 years ago

Hi – this code now breaks completely for mixpanelGetData because encoding is passed to mixpanelGetData as an element of arg, which compromises the call to the mixpanel API (it gets set as part of the URL). unfortunately, the new version (0.7) is now also on CRAN and is quite broken this way (for the raw data export anyway) I played @jzking's changes back onto a new fork of v0.6-3 and am working to fix this; the current implementation immediately fails, though; possibly due to some changes in jsonlite/RCurl since it was developed). will update with progress.

ploner commented 6 years ago

@christerwi - I will also take a look on this. Thanks for your information!

ploner commented 6 years ago

@christerwi - the error is a different one, and very minor. I will commit a new release in minutes. Btw, I did not copy the whole code from jzking - and did not put encoding into args. ;)

ploner commented 6 years ago

Committed to CRAN as 0.7-1.

I see, @christerwi added the right encoding implementation already in his version 4 days ago. Perfect. Thx to all contributors!

dlazarou commented 3 years ago

issue still persists unfortunately:

Error: lexical error: invalid character inside string.
          and":"samsung","$carrier":"MTNIrinde#Covid19 | MTN Rwanda",
                     (right here) ------^ 

Rmixpanel version 0.7-1