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

Inline IgnoreCase modifier does not work with non-ASCII #79

Open
stulov opened this issue Jul 21, 2023 · 0 comments · May be fixed by #80 or #90
Open

Inline IgnoreCase modifier does not work with non-ASCII #79

stulov opened this issue Jul 21, 2023 · 0 comments · May be fixed by #80 or #90

Comments

@stulov
Copy link

stulov commented Jul 21, 2023

Hello!

I've noticed that inline i modifier clause does not transpile properly (at least as for my understanding) when dealing with non-ASCII characters. Here are some tests that fail.

{
	'pattern': '(?i:k)',
	'flags': 'u',
	'options': { modifiers: 'transform' },
	'expected': '(?:[Kk\\u212A])',
}

Here, /(?i:k)/u is expected to be equivalent to /k/iu, but while the latter matches '\u212A', 'K', and 'k', the actual produced expression /(?:[Kk])/u won't match '\u212A'.

{
	'pattern': '(?i:є)',
	'expected': '(?i:[Єє])',
}

Similarly, for 'є', to which only 'Є' case folds, the resulting expression /(?:\u0454)/ (0454 is a code point for 'є' that is, the expression is /(?:є)/) fails to match 'Є'.

{
	'pattern': '(?i:[є-ґ])',
	'expected': '(?:[Є-Ґє-ґ])',
}

Likewise, here the result is /(?:[\u0454-\u0491])/, which is still case-sensitive and basically just replaced symbols with the escape sequences for them.

I've tried to figure it out myself, but didn't manage to. I believe the problem is either somewhere around the caseFold and configNeedCaseFold* functions, or in the way iuMappings are generated.

Thank you!

@stulov stulov linked a pull request Jul 23, 2023 that will close this issue
@JLHwung JLHwung linked a pull request Sep 30, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant