Closed
Description
Some portuguese language words has accents or hyphen, or sometimes both, like this example.
const Diff = require('diff')
const one = 'Para animá-los quando...';
const other = 'Para encorajá-los quando...';
const diff = Diff.diffWordsWithSpace(one, other);
let oldSentence = ''
let newSentence = ''
diff.forEach((part) => {
if (part.removed) oldSentence += part.value
if (part.added) newSentence += part.value
})
console.log('oldSentence', oldSentence)
console.log('newSentence', newSentence)
// diff: anim and encoraj - is truncated on accent
// just for test, if accent is removed, result it will be:
// diff: anima and encoraja - is truncated on hyphen
// just for test, if hyphen is removed, result it will be:
// diff: animalos and encorajalos - it works fine
Is this a known bug or not yet? Can I try to correct and send a PR?