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

normalizeDiacritics doesn't preserve ß (Eszett) #9

Closed
chocolateboy opened this issue Feb 25, 2021 · 2 comments
Closed

normalizeDiacritics doesn't preserve ß (Eszett) #9

chocolateboy opened this issue Feb 25, 2021 · 2 comments

Comments

@chocolateboy
Copy link

Node: v14.15.4 | OS: Linux (Arch) | normalize-text: v2.3.1

normalizeDiacritics unexpectedly removes the letter ß:

Input"Amélie plays Fußball"
Expected"Amelie plays Fußball" or "Amelie plays Fussball"
Actual"Amelie plays Fuball"
@chocolateboy
Copy link
Author

Looks like the substitution pattern is too wide and is removing non-diacritics:

? text.normalize('NFKD').replace(/[\u0080-\uF8FF]/g, '')

The character class listed here (via) appears to work as expected:

const normalize = str => str.normalize('NFKD').replace(/[\u0300-\u036F]/g, '')

normalize('Amélie plays Fußball') // "Amelie plays Fußball"

@VitorLuizC
Copy link
Owner

Fixed and released under version 2.3.2.

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

No branches or pull requests

2 participants