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

Diff breaks unicode characters for emojis #59

Open
orromis opened this issue Feb 28, 2019 · 2 comments · May be fixed by #69
Open

Diff breaks unicode characters for emojis #59

orromis opened this issue Feb 28, 2019 · 2 comments · May be fixed by #69

Comments

@orromis
Copy link

@orromis orromis commented Feb 28, 2019

I'm working message log in our app. We want to show diff of changes any user made on text posts. Those posts may include emoji characters but diff_match_patch replaces those characters with � character (but only if they changed in the text).

The behaviour can be reproduced here:
https://neil.fraser.name/software/diff_match_patch/demos/diff.html

Paste 😉and 😀into textareas and compute the diff.

Why is this happening?

@mcataford
Copy link

@mcataford mcataford commented Mar 6, 2019

Looks like the diffing doesn't consider whether a character is non-ASCII and breaks unicode emojis in pieces if they are different but occupy the same space. That would result in some unknown character � after all is said and done. Assuming it's conversion related.

Looking into it out of curiosity.

@judofyr judofyr linked a pull request that will close this issue Jun 20, 2019
@josephrocca
Copy link

@josephrocca josephrocca commented Aug 18, 2019

Looks like @yetanotherape has solved it for their PHP fork:

The two current attempts at solving it in this repo have both had complications:

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

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.