Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing encoding errors in FacebookMessenger parser #78

Merged
merged 2 commits into from
Jan 15, 2023
Merged

Fixing encoding errors in FacebookMessenger parser #78

merged 2 commits into from
Jan 15, 2023

Conversation

UntriexTv
Copy link
Contributor

Fix for #73 working on my side.
The reason for invalid encoding was because of non ASCII characters being encoded twice.
Explanation
The code now works without problems and gets rid of all emojis and wrongly encoded characters.
The slovak characters mentioned in the issue are fixed now:
image

@joweich
Copy link
Owner

joweich commented Jan 15, 2023

@UntriexTv Makes sense! I'm able to connect some dots now: We had a related issue for the Instagram Parser in #65 (see here).
It got resolved by @BlueishTint by going with

  "author": mess["sender_name"].encode("latin-1").decode("utf-8"),
  "message": body.encode("latin-1").decode("utf-8")

when composing the parsed message into the dict to return.
And this is the same solution like the first proposed resolution in the stackoverflow thread you linked.
Did you try this approach as well?
I think it's cleaner and has probably better performance since regex matching is quite expensive.

@UntriexTv
Copy link
Contributor Author

UntriexTv commented Jan 15, 2023

EDIT:
Ah yes sorry, I got it wrong, I'll implement this same fix for the Facebook parser. My bad

@UntriexTv
Copy link
Contributor Author

@joweich Tried with this fix too. Seems to work perfectly

@joweich joweich linked an issue Jan 15, 2023 that may be closed by this pull request
@joweich joweich merged commit cb67fd7 into joweich:main Jan 15, 2023
@joweich
Copy link
Owner

joweich commented Jan 15, 2023

@UntriexTv Thank you for your efforts and welcome as a contributor to this project! 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wordcloud also displays non printable characters (Workaround)
2 participants