Skip to content

Commit

Permalink
Support German letter ß in handles (#1652)
Browse files Browse the repository at this point in the history
# Goal
The goal of this PR is to add support in handles for the German letter
`ß`

Closes #1646

# Discussion
- Adds 4 lines to the confusables.rs

# Checklist
- [x] Tests added
  • Loading branch information
wilwade authored Aug 7, 2023
1 parent 1a10f62 commit e8796f5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
3 changes: 2 additions & 1 deletion pallets/handles/src/handles-utils/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use core::ops::RangeInclusive;

/// Character that are allowed.
pub const ALLOWED_UNICODE_CHARACTER_RANGES: [RangeInclusive<u16>; 20] = [
pub const ALLOWED_UNICODE_CHARACTER_RANGES: [RangeInclusive<u16>; 21] = [
0x0020..=0x007F, // Basic Latin
0x0080..=0x00FF, // Latin-1 Supplement
0x0100..=0x017F, // Latin Extended-A
Expand All @@ -16,6 +16,7 @@ pub const ALLOWED_UNICODE_CHARACTER_RANGES: [RangeInclusive<u16>; 20] = [
0x0980..=0x09FF, // Bengali
0x0E00..=0x0E7F, // Thai
0x1100..=0x11FF, // Hangul Jamo
0x1E00..=0x1EFF, // Latin Extended Additional
0x1F00..=0x1FFF, // Greek Extended
0x3040..=0x309F, // Hiragana
0x30A0..=0x30FF, // Katakana
Expand Down
41 changes: 24 additions & 17 deletions pallets/handles/src/handles-utils/src/tests/validator_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,30 @@ fn test_contains_blocked_characters_negative() {
#[test]
fn test_consists_of_supported_unicode_character_sets_happy_path() {
let strings_containing_characters_in_supported_unicode_character_sets = Vec::from([
"John", // Basic Latin
"Álvaro", // Latin-1 Supplement
"가영", // Hangul Syllables
"가나다", // Hangul Syllables
"アキラ", // Katakana
"あいこ", // Hiragana
"李明", // CJK Unified Ideographs
"严勇", // CJK Unified Ideographs
"龍", // CJK Unified Ideographs
"অমিত", // Bengali
"आरव", // Devanagari
"Александр", // Cyrillic
"Αλέξανδρος", // Greek and Coptic
"Ἀναξαγόρας", // Greek Extended
"กัญญา", // Thai
"عمر", // Arabic
"דָּנִיֵּאל", // Hewbrew
"John", // Basic Latin
"Álvaro", // Latin-1 Supplement
"가영", // Hangul Syllables
"가나다", // Hangul Syllables
"アキラ", // Katakana
"あいこ", // Hiragana
"李明", // CJK Unified Ideographs
"严勇", // CJK Unified Ideographs
"龍", // CJK Unified Ideographs
"অমিত", // Bengali
"आरव", // Devanagari
"Александр", // Cyrillic
"Αλέξανδρος", // Greek and Coptic
"Ἀναξαγόρας", // Greek Extended
"กัญญา", // Thai
"ابجدهوزحطيكلمنسعفصقرشتثخذضظغءعمر", // Arabic
"דָּנִיֵּאלאבּבגּגדּדהווּוֹזחטי ִיכּךּכךלמםנןסעפּףּפףצץקרשׁשׂתּת", // Hewbrew
"AaĄąBbCcĆćDdEeĘęFfGgHhIiJjKkLlŁłMmNnŃńOoÓóRrSsŚśYyZzŹźŻż", // Polish
"ÄäÖöÜüẞß", // German
"AÁBCČDĎEÉĚFGHChIÍJKLMNŇOÓPQRŘSŠTŤUÚŮVWXYÝZŽaábcčdďeéěfghchiíjklmnňoópqrřsštťuúůvwxyýzž", // Czech
"αιαιαιᾳειειηιῃοιοιυιυιωιῳαυαυᾹυᾱυευευηυηυουουωυωυγγγγγκγκγξγξγχγχμπμπντντΖζΤΖτζ", // Greek
"ÅåÄäÖö", // Swedish
"ÅåÄäÖöŠšŽž", // Finnish
"ÆæØøÅå", // Danish
]);

for string in strings_containing_characters_in_supported_unicode_character_sets {
Expand Down

0 comments on commit e8796f5

Please sign in to comment.