Skip to content

bugfix: char class casefold for certain chars #20

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

Closed
wants to merge 1 commit into from

Conversation

haozhun
Copy link
Contributor

@haozhun haozhun commented Mar 20, 2015

When a character is less than or equal to single byte size (0xff),
yet it takes more than 1 byte in the current encoding, the
case folding code incorrectly put it in bitset instead of code
range. As a result, for utf8 encoding, casefold works incorrectly
on characters in range \u0080 to \u00ff (latin1 supplement).

Before fix:

  • "\u00c2" [\u00e0-\u00e5] returns false
  • "\u00c2" [\u00e2] returns false
  • "\u00c2" \u00e2 returns true

When a character is less than or equal to single byte size (0xff),
yet it takes more than 1 byte in the current encoding, the
case folding code incorrectly put it in bitset instead of code
range. As a result, for utf8 encoding, casefold works incorrectly
on characters in range \u0080 to \u00ff (latin1 supplement).

Before fix:

* `"\u00c2"` `[\u00e0-\u00e5]` returns false
* `"\u00c2"` `[\u00e2]` returns false
* `"\u00c2"` `\u00e2` returns true
@headius
Copy link
Member

headius commented Jan 15, 2025

Close in favor of rebased #85.

@headius headius closed this Jan 15, 2025
@headius headius added this to the Invalid or Duplicate milestone Jan 15, 2025
@headius
Copy link
Member

headius commented Mar 3, 2025

I merged and released 2.2.4 with #85. I also filed an issue with CRuby for the same issue, and they have a similar fix in the past few days we should consider: https://bugs.ruby-lang.org/issues/21162

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

Successfully merging this pull request may close these issues.

2 participants