You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'diff-match-patch' have issues with surrogate pairs when diffing, you can test it in the live demo by changing:
left
...
"summary": "South America😀👍...
...
right
...
"summary": "South America👍...
...
Then the diff below disappears and you can see this error in console:
URIError: URI malformed
at encodeURI (<anonymous>)
at diff_match_patch.patch_obj.toString (demo.js:1476:30)
at Array.join (<anonymous>)
at diff_match_patch.patch_toText (demo.js:1377:21)
at diff (demo.js:2457:28)
at textsDiffFilter (demo.js:2490:24)
at Pipe.process (demo.js:1570:9)
at Processor.process (demo.js:1537:18)
at DiffPatcher.diff (demo.js:2560:29)
at compare2 (demo.js:3470:30)
In my own use of jsondiffpatch I have replaced diff-match-patch like this:
import type { Options } from 'jsondiffpatch';
import { diff_match_patch } from '@dmsnell/diff-match-patch';
/** replacing diff-match-patch with version from dmsnell which fixes surrogate pair problems */
export const CustomDMP = diff_match_patch as unknown as NonNullable<Options['textDiff']>['diffMatchPatch'];
and then importing CustomDMP into jsondiffpatch via options...
And many thanks for a powerful library with an api that actually allowed me to replace this dependency, and also create my own custom formatter with support for text diff patches👍
'diff-match-patch' have issues with surrogate pairs when diffing, you can test it in the live demo by changing:
left
right
Then the diff below disappears and you can see this error in console:
In my own use of jsondiffpatch I have replaced diff-match-patch like this:
and then importing CustomDMP into jsondiffpatch via options...
As a bonus @dmsnell/diff-match-patch is also exported as esm...
The text was updated successfully, but these errors were encountered: