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

Fix NFKD for accented digraph followed by accent #4530

Merged
merged 5 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
- New `DateTime::local_unix_epoch()` convenience constructor (https://github.com/unicode-org/icu4x/pull/4479)
- `icu_datetime`
- `FormattedDateTime` and `FormattedZonedDateTime` now implement `Clone` and `Copy` (https://github.com/unicode-org/icu4x/pull/4476)
- `icu_normalizer`
- Fix normalization of character whose decomposition contains more than one starter and ends with a non-starter followed by a non-starter
with a lower Canonical Combining Class than the last character of the decomposition. (https://github.com/unicode-org/icu4x/pull/4530)
- `icu_properties`
- Add `Aran` script code (https://github.com/unicode-org/icu4x/pull/4426)
- `icu_segmenter`
Expand Down Expand Up @@ -51,7 +54,7 @@

- General
- MSRV is now 1.67

- Components
- Compiled data updated to CLDR 44 and ICU 74 (https://github.com/unicode-org/icu4x/pull/4245)
- `icu_calendar`
Expand Down
4 changes: 2 additions & 2 deletions components/normalizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ where
i += 1;
// Half-width kana and iota subscript don't occur in the tails
// of these multicharacter decompositions.
if decomposition_starts_with_non_starter(trie_value) {
if !decomposition_starts_with_non_starter(trie_value) {
combining_start = i;
}
}
Expand Down Expand Up @@ -676,7 +676,7 @@ where
i += 1;
// Half-width kana and iota subscript don't occur in the tails
// of these multicharacter decompositions.
if decomposition_starts_with_non_starter(trie_value) {
if !decomposition_starts_with_non_starter(trie_value) {
combining_start = i;
}
}
Expand Down
22 changes: 22 additions & 0 deletions components/normalizer/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,28 @@ fn test_utf16_basic() {
);
}

#[test]
fn test_accented_digraph() {
let normalizer: DecomposingNormalizer = DecomposingNormalizer::new_nfkd();
assert_eq!(
normalizer.normalize("\u{01C4}\u{0323}"),
"DZ\u{0323}\u{030C}"
);
assert_eq!(
normalizer.normalize("DZ\u{030C}\u{0323}"),
"DZ\u{0323}\u{030C}"
);
}

#[test]
fn test_ddd() {
let normalizer: DecomposingNormalizer = DecomposingNormalizer::new_nfd();
assert_eq!(
normalizer.normalize("\u{0DDD}\u{0334}"),
"\u{0DD9}\u{0DCF}\u{0334}\u{0DCA}"
);
}

#[test]
fn test_is_normalized() {
let nfd: DecomposingNormalizer = DecomposingNormalizer::new_nfd();
Expand Down