From 48c7f349f68846e10d60ae77ad299a38ee014479 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 1 Nov 2025 20:14:42 +0100 Subject: [PATCH 1/4] Fix rescue in test_ractor.rb --- bootstraptest/test_ractor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb index f008bc82a4add1..25af87b610ef83 100644 --- a/bootstraptest/test_ractor.rb +++ b/bootstraptest/test_ractor.rb @@ -1297,7 +1297,7 @@ class C s = 'str' trap(:INT){p s} }.join - rescue => Ractor::RemoteError + rescue Ractor::RemoteError a << :ok end } From a122d7a58e91ed6cd531e906cb398688d7cc8b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20D=C3=BCrst?= Date: Mon, 27 Oct 2025 21:17:06 +0900 Subject: [PATCH 2/4] Add regression test for bug 21559. --- test/test_unicode_normalize.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/test_unicode_normalize.rb b/test/test_unicode_normalize.rb index 98f46551d33374..120ff01cd48c50 100644 --- a/test/test_unicode_normalize.rb +++ b/test/test_unicode_normalize.rb @@ -210,6 +210,11 @@ def test_us_ascii assert_equal true, ascii_string.unicode_normalized?(:nfkd) end + def test_bug_21559 + str = "s\u{1611e}\u{323}\u{1611e}\u{307}\u{1611f}" + assert_equal str.unicode_normalize(:nfd), str.unicode_normalize(:nfc).unicode_normalize(:nfd) + end + def test_canonical_ordering a = "\u03B1\u0313\u0300\u0345" a_unordered1 = "\u03B1\u0345\u0313\u0300" From 83a943b5948efbe5a2a6de9fa425482c51e536fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20D=C3=BCrst?= Date: Mon, 27 Oct 2025 21:22:50 +0900 Subject: [PATCH 3/4] Add test for Unicode normalization of Gurung Khema. --- test/test_unicode_normalize.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/test_unicode_normalize.rb b/test/test_unicode_normalize.rb index 120ff01cd48c50..dd06d271310ad9 100644 --- a/test/test_unicode_normalize.rb +++ b/test/test_unicode_normalize.rb @@ -215,6 +215,10 @@ def test_bug_21559 assert_equal str.unicode_normalize(:nfd), str.unicode_normalize(:nfc).unicode_normalize(:nfd) end + def test_gurung_khema + assert_equal "\u{16121 16121 16121 16121 16121 1611E}", "\u{1611E 16121 16121 16121 16121 16121}".unicode_normalize + end + def test_canonical_ordering a = "\u03B1\u0313\u0300\u0345" a_unordered1 = "\u03B1\u0345\u0313\u0300" From e4c8e3544237b8c0efba6b945173dc66552d641c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20D=C3=BCrst?= Date: Sun, 2 Nov 2025 09:18:32 +0900 Subject: [PATCH 4/4] Remove recursion in UnicodeNormalize.nfc_one, fixing bug 21159. --- lib/unicode_normalize/normalize.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/unicode_normalize/normalize.rb b/lib/unicode_normalize/normalize.rb index 7872f8a0bcffdd..611f43ef2aa0ad 100644 --- a/lib/unicode_normalize/normalize.rb +++ b/lib/unicode_normalize/normalize.rb @@ -111,17 +111,22 @@ def self.nfc_one(string) start = nfd_string[0] last_class = CLASS_TABLE[start]-1 accents = '' + result = '' nfd_string[1..-1].each_char do |accent| accent_class = CLASS_TABLE[accent] if last_class1 # TODO: change from recursion to loop - hangul_comp_one(start+accents) + hangul_comp_one(result+start+accents) end def self.normalize(string, form = :nfc)