atuin_common/string/normalize.rs
1//! Latin-diacritic to ASCII normalization table.
2//!
3//! Vendored from atuin-nucleo, a fork of helix-editor/nucleo:
4//!
5//! <https://github.com/atuinsh/atuin/blob/v18.18.1/crates/atuin-nucleo/matcher/src/chars/normalize.rs>
6//!
7//! nucleo is licensed under the Mozilla Public License 2.0; this file remains
8//! covered by MPL-2.0 (<https://mozilla.org/MPL/2.0/>) independently of the
9//! crate's license.
10
11/// Normalize a Unicode character by converting Latin characters which are variants
12/// of ASCII characters to their latin equivalent.
13///
14/// Note that this method acts on single `char`s: if you want to perform full normalization, you
15/// should first split on graphemes, and then normalize each grapheme by normalizing the first
16/// `char` in the grapheme.
17///
18/// If a character does not normalize to a single ASCII character, no normalization is performed.
19///
20/// This performs normalization within the following Unicode blocks:
21///
22/// - [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement)
23/// - [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
24/// - [Latin Extended-B](https://en.wikipedia.org/wiki/Latin_Extended-B)
25/// - [Latin Extended Additional](https://en.wikipedia.org/wiki/Latin_Extended_Additional)
26/// - [Superscripts and Subscripts](https://en.wikipedia.org/wiki/Superscripts_and_Subscripts)
27///
28/// If the character does not fall in this block, it is not normalized.
29///
30/// # Example
31///
32/// `normalize('ä') == 'a'`, `normalize('Æ') == 'Æ'`, `normalize('ữ') == 'u'`
33pub fn normalize(c: char) -> char {
34 // outside checked blocks
35 if c < '\u{a0}' || c >= '\u{20A0}' {
36 return c;
37 }
38 // Latin-1 Supplement, Extended-A, Extended-B
39 if c <= '\u{29f}' {
40 return LATIN_1AB[c as usize - '\u{a0}' as usize];
41 }
42 // between blocks
43 if c < '\u{1e00}' {
44 return c;
45 }
46 // Latin Extended Additional
47 if c <= '\u{1eff}' {
48 return LATIN_EXTENDED_ADDITIONAL[c as usize - '\u{1e00}' as usize];
49 }
50 // between blocks
51 if c < '\u{2070}' {
52 return c;
53 }
54 // Superscripts and subscripts
55 SUPERSCRIPTS_AND_SUBSCRIPTS[c as usize - '\u{2070}' as usize]
56}
57
58/// A char array corresponding to the following contiguous Unicode blocks:
59///
60/// - [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement)
61/// - [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
62/// - [Latin Extended-B](https://en.wikipedia.org/wiki/Latin_Extended-B)
63///
64/// This covers the range `'\u{a0}'..='\u{29f}'`.
65static LATIN_1AB: [char; 512] = [
66 '\u{a0}', // invisible NON BREAKING SPACE
67 '!', // '¡'; '\u{a1}'
68 '¢', // '¢'; '\u{a2}'
69 '£', // '£'; '\u{a3}'
70 '¤', // '¤'; '\u{a4}'
71 '¥', // '¥'; '\u{a5}'
72 '¦', // '¦'; '\u{a6}'
73 '§', // '§'; '\u{a7}'
74 '¨', // '¨'; '\u{a8}'
75 '©', // '©'; '\u{a9}'
76 'a', // 'ª'; '\u{aa}'
77 '«', // '«'; '\u{ab}'
78 '¬', // '¬'; '\u{ac}'
79 '\u{ad}', // invisible SOFT HYPHEN
80 '®', // '®'; '\u{ae}'
81 '¯', // '¯'; '\u{af}'
82 '°', // '°'; '\u{b0}'
83 '±', // '±'; '\u{b1}'
84 '2', // '²'; '\u{b2}'
85 '3', // '³'; '\u{b3}'
86 '´', // '´'; '\u{b4}'
87 'µ', // 'µ'; '\u{b5}'
88 '¶', // '¶'; '\u{b6}'
89 '·', // '·'; '\u{b7}'
90 '¸', // '¸'; '\u{b8}'
91 '1', // '¹'; '\u{b9}'
92 '0', // 'º'; '\u{ba}'
93 '»', // '»'; '\u{bb}'
94 '¼', // '¼'; '\u{bc}'
95 '½', // '½'; '\u{bd}'
96 '¾', // '¾'; '\u{be}'
97 '?', // '¿'; '\u{bf}'
98 'A', // 'À'; '\u{c0}'
99 'A', // 'Á'; '\u{c1}'
100 'A', // 'Â'; '\u{c2}'
101 'A', // 'Ã'; '\u{c3}'
102 'A', // 'Ä'; '\u{c4}'
103 'A', // 'Å'; '\u{c5}'
104 'Æ', // 'Æ'; '\u{c6}'
105 'C', // 'Ç'; '\u{c7}'
106 'E', // 'È'; '\u{c8}'
107 'E', // 'É'; '\u{c9}'
108 'E', // 'Ê'; '\u{ca}'
109 'E', // 'Ë'; '\u{cb}'
110 'I', // 'Ì'; '\u{cc}'
111 'I', // 'Í'; '\u{cd}'
112 'I', // 'Î'; '\u{ce}'
113 'I', // 'Ï'; '\u{cf}'
114 'D', // 'Ð'; '\u{d0}'
115 'N', // 'Ñ'; '\u{d1}'
116 'O', // 'Ò'; '\u{d2}'
117 'O', // 'Ó'; '\u{d3}'
118 'O', // 'Ô'; '\u{d4}'
119 'O', // 'Õ'; '\u{d5}'
120 'O', // 'Ö'; '\u{d6}'
121 '×', // '×'; '\u{d7}'
122 'O', // 'Ø'; '\u{d8}'
123 'U', // 'Ù'; '\u{d9}'
124 'U', // 'Ú'; '\u{da}'
125 'U', // 'Û'; '\u{db}'
126 'U', // 'Ü'; '\u{dc}'
127 'Y', // 'Ý'; '\u{dd}'
128 'Þ', // 'Þ'; '\u{de}'
129 's', // 'ß'; '\u{df}'
130 'a', // 'à'; '\u{e0}'
131 'a', // 'á'; '\u{e1}'
132 'a', // 'â'; '\u{e2}'
133 'a', // 'ã'; '\u{e3}'
134 'a', // 'ä'; '\u{e4}'
135 'a', // 'å'; '\u{e5}'
136 'æ', // 'æ'; '\u{e6}'
137 'c', // 'ç'; '\u{e7}'
138 'e', // 'è'; '\u{e8}'
139 'e', // 'é'; '\u{e9}'
140 'e', // 'ê'; '\u{ea}'
141 'e', // 'ë'; '\u{eb}'
142 'i', // 'ì'; '\u{ec}'
143 'i', // 'í'; '\u{ed}'
144 'i', // 'î'; '\u{ee}'
145 'i', // 'ï'; '\u{ef}'
146 'd', // 'ð'; '\u{f0}'
147 'n', // 'ñ'; '\u{f1}'
148 'o', // 'ò'; '\u{f2}'
149 'o', // 'ó'; '\u{f3}'
150 'o', // 'ô'; '\u{f4}'
151 'o', // 'õ'; '\u{f5}'
152 'o', // 'ö'; '\u{f6}'
153 '÷', // '÷'; '\u{f7}'
154 'o', // 'ø'; '\u{f8}'
155 'u', // 'ù'; '\u{f9}'
156 'u', // 'ú'; '\u{fa}'
157 'u', // 'û'; '\u{fb}'
158 'u', // 'ü'; '\u{fc}'
159 'y', // 'ý'; '\u{fd}'
160 'þ', // 'þ'; '\u{fe}'
161 'y', // 'ÿ'; '\u{ff}'
162 'A', // 'Ā'; '\u{100}'
163 'a', // 'ā'; '\u{101}'
164 'A', // 'Ă'; '\u{102}'
165 'a', // 'ă'; '\u{103}'
166 'A', // 'Ą'; '\u{104}'
167 'a', // 'ą'; '\u{105}'
168 'C', // 'Ć'; '\u{106}'
169 'c', // 'ć'; '\u{107}'
170 'C', // 'Ĉ'; '\u{108}'
171 'c', // 'ĉ'; '\u{109}'
172 'C', // 'Ċ'; '\u{10a}'
173 'c', // 'ċ'; '\u{10b}'
174 'C', // 'Č'; '\u{10c}'
175 'c', // 'č'; '\u{10d}'
176 'D', // 'Ď'; '\u{10e}'
177 'd', // 'ď'; '\u{10f}'
178 'D', // 'Đ'; '\u{110}'
179 'd', // 'đ'; '\u{111}'
180 'E', // 'Ē'; '\u{112}'
181 'e', // 'ē'; '\u{113}'
182 'E', // 'Ĕ'; '\u{114}'
183 'e', // 'ĕ'; '\u{115}'
184 'E', // 'Ė'; '\u{116}'
185 'e', // 'ė'; '\u{117}'
186 'E', // 'Ę'; '\u{118}'
187 'e', // 'ę'; '\u{119}'
188 'E', // 'Ě'; '\u{11a}'
189 'e', // 'ě'; '\u{11b}'
190 'G', // 'Ĝ'; '\u{11c}'
191 'g', // 'ĝ'; '\u{11d}'
192 'G', // 'Ğ'; '\u{11e}'
193 'g', // 'ğ'; '\u{11f}'
194 'G', // 'Ġ'; '\u{120}'
195 'g', // 'ġ'; '\u{121}'
196 'G', // 'Ģ'; '\u{122}'
197 'g', // 'ģ'; '\u{123}'
198 'H', // 'Ĥ'; '\u{124}'
199 'h', // 'ĥ'; '\u{125}'
200 'H', // 'Ħ'; '\u{126}'
201 'h', // 'ħ'; '\u{127}'
202 'I', // 'Ĩ'; '\u{128}'
203 'i', // 'ĩ'; '\u{129}'
204 'I', // 'Ī'; '\u{12a}'
205 'i', // 'ī'; '\u{12b}'
206 'I', // 'Ĭ'; '\u{12c}'
207 'i', // 'ĭ'; '\u{12d}'
208 'I', // 'Į'; '\u{12e}'
209 'i', // 'į'; '\u{12f}'
210 'I', // 'İ'; '\u{130}'
211 'i', // 'ı'; '\u{131}'
212 'IJ', // 'IJ'; '\u{132}'
213 'ij', // 'ij'; '\u{133}'
214 'J', // 'Ĵ'; '\u{134}'
215 'j', // 'ĵ'; '\u{135}'
216 'K', // 'Ķ'; '\u{136}'
217 'k', // 'ķ'; '\u{137}'
218 'ĸ', // 'ĸ'; '\u{138}'
219 'L', // 'Ĺ'; '\u{139}'
220 'l', // 'ĺ'; '\u{13a}'
221 'L', // 'Ļ'; '\u{13b}'
222 'l', // 'ļ'; '\u{13c}'
223 'L', // 'Ľ'; '\u{13d}'
224 'l', // 'ľ'; '\u{13e}'
225 'L', // 'Ŀ'; '\u{13f}'
226 'l', // 'ŀ'; '\u{140}'
227 'L', // 'Ł'; '\u{141}'
228 'l', // 'ł'; '\u{142}'
229 'N', // 'Ń'; '\u{143}'
230 'n', // 'ń'; '\u{144}'
231 'N', // 'Ņ'; '\u{145}'
232 'n', // 'ņ'; '\u{146}'
233 'N', // 'Ň'; '\u{147}'
234 'n', // 'ň'; '\u{148}'
235 'n', // 'ʼn'; '\u{149}'
236 'N', // 'Ŋ'; '\u{14a}'
237 'n', // 'ŋ'; '\u{14b}'
238 'O', // 'Ō'; '\u{14c}'
239 'o', // 'ō'; '\u{14d}'
240 'O', // 'Ŏ'; '\u{14e}'
241 'o', // 'ŏ'; '\u{14f}'
242 'O', // 'Ő'; '\u{150}'
243 'o', // 'ő'; '\u{151}'
244 'Œ', // 'Œ'; '\u{152}'
245 'œ', // 'œ'; '\u{153}'
246 'R', // 'Ŕ'; '\u{154}'
247 'r', // 'ŕ'; '\u{155}'
248 'R', // 'Ŗ'; '\u{156}'
249 'r', // 'ŗ'; '\u{157}'
250 'R', // 'Ř'; '\u{158}'
251 'r', // 'ř'; '\u{159}'
252 'S', // 'Ś'; '\u{15a}'
253 's', // 'ś'; '\u{15b}'
254 'S', // 'Ŝ'; '\u{15c}'
255 's', // 'ŝ'; '\u{15d}'
256 'S', // 'Ş'; '\u{15e}'
257 's', // 'ş'; '\u{15f}'
258 'S', // 'Š'; '\u{160}'
259 's', // 'š'; '\u{161}'
260 'T', // 'Ţ'; '\u{162}'
261 't', // 'ţ'; '\u{163}'
262 'T', // 'Ť'; '\u{164}'
263 't', // 'ť'; '\u{165}'
264 'T', // 'Ŧ'; '\u{166}'
265 't', // 'ŧ'; '\u{167}'
266 'U', // 'Ũ'; '\u{168}'
267 'u', // 'ũ'; '\u{169}'
268 'U', // 'Ū'; '\u{16a}'
269 'u', // 'ū'; '\u{16b}'
270 'U', // 'Ŭ'; '\u{16c}'
271 'u', // 'ŭ'; '\u{16d}'
272 'U', // 'Ů'; '\u{16e}'
273 'u', // 'ů'; '\u{16f}'
274 'U', // 'Ű'; '\u{170}'
275 'u', // 'ű'; '\u{171}'
276 'U', // 'Ų'; '\u{172}'
277 'u', // 'ų'; '\u{173}'
278 'W', // 'Ŵ'; '\u{174}'
279 'w', // 'ŵ'; '\u{175}'
280 'Y', // 'Ŷ'; '\u{176}'
281 'y', // 'ŷ'; '\u{177}'
282 'Y', // 'Ÿ'; '\u{178}'
283 'Z', // 'Ź'; '\u{179}'
284 'z', // 'ź'; '\u{17a}'
285 'Z', // 'Ż'; '\u{17b}'
286 'z', // 'ż'; '\u{17c}'
287 'Z', // 'Ž'; '\u{17d}'
288 'z', // 'ž'; '\u{17e}'
289 's', // 'ſ'; '\u{17f}'
290 'b', // 'ƀ'; '\u{180}'
291 'B', // 'Ɓ'; '\u{181}'
292 'b', // 'Ƃ'; '\u{182}'
293 'b', // 'ƃ'; '\u{183}'
294 'b', // 'Ƅ'; '\u{184}'
295 'ƅ', // 'ƅ'; '\u{185}'
296 'O', // 'Ɔ'; '\u{186}'
297 'C', // 'Ƈ'; '\u{187}'
298 'c', // 'ƈ'; '\u{188}'
299 'D', // 'Ɖ'; '\u{189}'
300 'D', // 'Ɗ'; '\u{18a}'
301 'd', // 'Ƌ'; '\u{18b}'
302 'd', // 'ƌ'; '\u{18c}'
303 'ƍ', // 'ƍ'; '\u{18d}'
304 'E', // 'Ǝ'; '\u{18e}'
305 'e', // 'Ə'; '\u{18f}'
306 'E', // 'Ɛ'; '\u{190}'
307 'F', // 'Ƒ'; '\u{191}'
308 'f', // 'ƒ'; '\u{192}'
309 'G', // 'Ɠ'; '\u{193}'
310 'Ɣ', // 'Ɣ'; '\u{194}'
311 'h', // 'ƕ'; '\u{195}'
312 'I', // 'Ɩ'; '\u{196}'
313 'I', // 'Ɨ'; '\u{197}'
314 'Ƙ', // 'Ƙ'; '\u{198}'
315 'k', // 'ƙ'; '\u{199}'
316 'l', // 'ƚ'; '\u{19a}'
317 'ƛ', // 'ƛ'; '\u{19b}'
318 'M', // 'Ɯ'; '\u{19c}'
319 'N', // 'Ɲ'; '\u{19d}'
320 'n', // 'ƞ'; '\u{19e}'
321 'O', // 'Ɵ'; '\u{19f}'
322 'O', // 'Ơ'; '\u{1a0}'
323 'o', // 'ơ'; '\u{1a1}'
324 'Ƣ', // 'Ƣ'; '\u{1a2}'
325 'ƣ', // 'ƣ'; '\u{1a3}'
326 'P', // 'Ƥ'; '\u{1a4}'
327 'p', // 'ƥ'; '\u{1a5}'
328 'R', // 'Ʀ'; '\u{1a6}'
329 'S', // 'Ƨ'; '\u{1a7}'
330 's', // 'ƨ'; '\u{1a8}'
331 'Ʃ', // 'Ʃ'; '\u{1a9}'
332 'l', // 'ƪ'; '\u{1aa}'
333 't', // 'ƫ'; '\u{1ab}'
334 'T', // 'Ƭ'; '\u{1ac}'
335 't', // 'ƭ'; '\u{1ad}'
336 'T', // 'Ʈ'; '\u{1ae}'
337 'U', // 'Ư'; '\u{1af}'
338 'u', // 'ư'; '\u{1b0}'
339 'Ʊ', // 'Ʊ'; '\u{1b1}'
340 'V', // 'Ʋ'; '\u{1b2}'
341 'Y', // 'Ƴ'; '\u{1b3}'
342 'y', // 'ƴ'; '\u{1b4}'
343 'Z', // 'Ƶ'; '\u{1b5}'
344 'z', // 'ƶ'; '\u{1b6}'
345 'Ʒ', // 'Ʒ'; '\u{1b7}'
346 'Ƹ', // 'Ƹ'; '\u{1b8}'
347 'ƹ', // 'ƹ'; '\u{1b9}'
348 'ƺ', // 'ƺ'; '\u{1ba}'
349 'ƻ', // 'ƻ'; '\u{1bb}'
350 'Ƽ', // 'Ƽ'; '\u{1bc}'
351 'ƽ', // 'ƽ'; '\u{1bd}'
352 'ƾ', // 'ƾ'; '\u{1be}'
353 'ƿ', // 'ƿ'; '\u{1bf}'
354 'ǀ', // 'ǀ'; '\u{1c0}'
355 'ǁ', // 'ǁ'; '\u{1c1}'
356 'ǂ', // 'ǂ'; '\u{1c2}'
357 '!', // 'ǃ'; '\u{1c3}'
358 'DŽ', // 'DŽ'; '\u{1c4}'
359 'Dž', // 'Dž'; '\u{1c5}'
360 'dž', // 'dž'; '\u{1c6}'
361 'LJ', // 'LJ'; '\u{1c7}'
362 'Lj', // 'Lj'; '\u{1c8}'
363 'lj', // 'lj'; '\u{1c9}'
364 'NJ', // 'NJ'; '\u{1ca}'
365 'Nj', // 'Nj'; '\u{1cb}'
366 'nj', // 'nj'; '\u{1cc}'
367 'A', // 'Ǎ'; '\u{1cd}'
368 'a', // 'ǎ'; '\u{1ce}'
369 'I', // 'Ǐ'; '\u{1cf}'
370 'i', // 'ǐ'; '\u{1d0}'
371 'O', // 'Ǒ'; '\u{1d1}'
372 'o', // 'ǒ'; '\u{1d2}'
373 'U', // 'Ǔ'; '\u{1d3}'
374 'u', // 'ǔ'; '\u{1d4}'
375 'U', // 'Ǖ'; '\u{1d5}'
376 'u', // 'ǖ'; '\u{1d6}'
377 'U', // 'Ǘ'; '\u{1d7}'
378 'u', // 'ǘ'; '\u{1d8}'
379 'U', // 'Ǚ'; '\u{1d9}'
380 'u', // 'ǚ'; '\u{1da}'
381 'U', // 'Ǜ'; '\u{1db}'
382 'u', // 'ǜ'; '\u{1dc}'
383 'e', // 'ǝ'; '\u{1dd}'
384 'A', // 'Ǟ'; '\u{1de}'
385 'a', // 'ǟ'; '\u{1df}'
386 'A', // 'Ǡ'; '\u{1e0}'
387 'a', // 'ǡ'; '\u{1e1}'
388 'Æ', // 'Ǣ'; '\u{1e2}'
389 'æ', // 'ǣ'; '\u{1e3}'
390 'G', // 'Ǥ'; '\u{1e4}'
391 'g', // 'ǥ'; '\u{1e5}'
392 'G', // 'Ǧ'; '\u{1e6}'
393 'g', // 'ǧ'; '\u{1e7}'
394 'K', // 'Ǩ'; '\u{1e8}'
395 'k', // 'ǩ'; '\u{1e9}'
396 'O', // 'Ǫ'; '\u{1ea}'
397 'o', // 'ǫ'; '\u{1eb}'
398 'O', // 'Ǭ'; '\u{1ec}'
399 'o', // 'ǭ'; '\u{1ed}'
400 'Ǯ', // 'Ǯ'; '\u{1ee}'
401 'ǯ', // 'ǯ'; '\u{1ef}'
402 'j', // 'ǰ'; '\u{1f0}'
403 'DZ', // 'DZ'; '\u{1f1}'
404 'Dz', // 'Dz'; '\u{1f2}'
405 'dz', // 'dz'; '\u{1f3}'
406 'G', // 'Ǵ'; '\u{1f4}'
407 'g', // 'ǵ'; '\u{1f5}'
408 'Ƕ', // 'Ƕ'; '\u{1f6}'
409 'Ƿ', // 'Ƿ'; '\u{1f7}'
410 'N', // 'Ǹ'; '\u{1f8}'
411 'n', // 'ǹ'; '\u{1f9}'
412 'A', // 'Ǻ'; '\u{1fa}'
413 'a', // 'ǻ'; '\u{1fb}'
414 'Æ', // 'Ǽ'; '\u{1fc}'
415 'æ', // 'ǽ'; '\u{1fd}'
416 'O', // 'Ǿ'; '\u{1fe}'
417 'o', // 'ǿ'; '\u{1ff}'
418 'A', // 'Ȁ'; '\u{200}'
419 'a', // 'ȁ'; '\u{201}'
420 'A', // 'Ȃ'; '\u{202}'
421 'a', // 'ȃ'; '\u{203}'
422 'E', // 'Ȅ'; '\u{204}'
423 'e', // 'ȅ'; '\u{205}'
424 'E', // 'Ȇ'; '\u{206}'
425 'e', // 'ȇ'; '\u{207}'
426 'I', // 'Ȉ'; '\u{208}'
427 'i', // 'ȉ'; '\u{209}'
428 'I', // 'Ȋ'; '\u{20a}'
429 'i', // 'ȋ'; '\u{20b}'
430 'O', // 'Ȍ'; '\u{20c}'
431 'o', // 'ȍ'; '\u{20d}'
432 'O', // 'Ȏ'; '\u{20e}'
433 'o', // 'ȏ'; '\u{20f}'
434 'R', // 'Ȑ'; '\u{210}'
435 'r', // 'ȑ'; '\u{211}'
436 'R', // 'Ȓ'; '\u{212}'
437 'r', // 'ȓ'; '\u{213}'
438 'U', // 'Ȕ'; '\u{214}'
439 'u', // 'ȕ'; '\u{215}'
440 'U', // 'Ȗ'; '\u{216}'
441 'u', // 'ȗ'; '\u{217}'
442 'S', // 'Ș'; '\u{218}'
443 's', // 'ș'; '\u{219}'
444 'T', // 'Ț'; '\u{21a}'
445 't', // 'ț'; '\u{21b}'
446 'Ȝ', // 'Ȝ'; '\u{21c}'
447 'ȝ', // 'ȝ'; '\u{21d}'
448 'H', // 'Ȟ'; '\u{21e}'
449 'h', // 'ȟ'; '\u{21f}'
450 'N', // 'Ƞ'; '\u{220}'
451 'd', // 'ȡ'; '\u{221}'
452 'Ȣ', // 'Ȣ'; '\u{222}'
453 'ȣ', // 'ȣ'; '\u{223}'
454 'Z', // 'Ȥ'; '\u{224}'
455 'z', // 'ȥ'; '\u{225}'
456 'A', // 'Ȧ'; '\u{226}'
457 'a', // 'ȧ'; '\u{227}'
458 'E', // 'Ȩ'; '\u{228}'
459 'e', // 'ȩ'; '\u{229}'
460 'O', // 'Ȫ'; '\u{22a}'
461 'o', // 'ȫ'; '\u{22b}'
462 'O', // 'Ȭ'; '\u{22c}'
463 'o', // 'ȭ'; '\u{22d}'
464 'O', // 'Ȯ'; '\u{22e}'
465 'o', // 'ȯ'; '\u{22f}'
466 'O', // 'Ȱ'; '\u{230}'
467 'o', // 'ȱ'; '\u{231}'
468 'Y', // 'Ȳ'; '\u{232}'
469 'y', // 'ȳ'; '\u{233}'
470 'l', // 'ȴ'; '\u{234}'
471 'n', // 'ȵ'; '\u{235}'
472 't', // 'ȶ'; '\u{236}'
473 'j', // 'ȷ'; '\u{237}'
474 'ȸ', // 'ȸ'; '\u{238}'
475 'ȹ', // 'ȹ'; '\u{239}'
476 'A', // 'Ⱥ'; '\u{23a}'
477 'C', // 'Ȼ'; '\u{23b}'
478 'c', // 'ȼ'; '\u{23c}'
479 'L', // 'Ƚ'; '\u{23d}'
480 'T', // 'Ⱦ'; '\u{23e}'
481 's', // 'ȿ'; '\u{23f}'
482 'z', // 'ɀ'; '\u{240}'
483 'Ɂ', // 'Ɂ'; '\u{241}'
484 'ɂ', // 'ɂ'; '\u{242}'
485 'B', // 'Ƀ'; '\u{243}'
486 'U', // 'Ʉ'; '\u{244}'
487 'V', // 'Ʌ'; '\u{245}'
488 'E', // 'Ɇ'; '\u{246}'
489 'e', // 'ɇ'; '\u{247}'
490 'J', // 'Ɉ'; '\u{248}'
491 'j', // 'ɉ'; '\u{249}'
492 'Q', // 'Ɋ'; '\u{24a}'
493 'q', // 'ɋ'; '\u{24b}'
494 'R', // 'Ɍ'; '\u{24c}'
495 'r', // 'ɍ'; '\u{24d}'
496 'Y', // 'Ɏ'; '\u{24e}'
497 'y', // 'ɏ'; '\u{24f}'
498 'a', // 'ɐ'; '\u{250}'
499 'a', // 'ɑ'; '\u{251}'
500 'a', // 'ɒ'; '\u{252}'
501 'b', // 'ɓ'; '\u{253}'
502 'c', // 'ɔ'; '\u{254}'
503 'c', // 'ɕ'; '\u{255}'
504 'd', // 'ɖ'; '\u{256}'
505 'd', // 'ɗ'; '\u{257}'
506 'e', // 'ɘ'; '\u{258}'
507 'e', // 'ə'; '\u{259}'
508 'e', // 'ɚ'; '\u{25a}'
509 'e', // 'ɛ'; '\u{25b}'
510 'e', // 'ɜ'; '\u{25c}'
511 'e', // 'ɝ'; '\u{25d}'
512 'e', // 'ɞ'; '\u{25e}'
513 'j', // 'ɟ'; '\u{25f}'
514 'g', // 'ɠ'; '\u{260}'
515 'g', // 'ɡ'; '\u{261}'
516 'G', // 'ɢ'; '\u{262}'
517 'g', // 'ɣ'; '\u{263}'
518 'u', // 'ɤ'; '\u{264}'
519 'h', // 'ɥ'; '\u{265}'
520 'h', // 'ɦ'; '\u{266}'
521 'h', // 'ɧ'; '\u{267}'
522 'i', // 'ɨ'; '\u{268}'
523 'i', // 'ɩ'; '\u{269}'
524 'I', // 'ɪ'; '\u{26a}'
525 'l', // 'ɫ'; '\u{26b}'
526 'l', // 'ɬ'; '\u{26c}'
527 'l', // 'ɭ'; '\u{26d}'
528 'ɮ', // 'ɮ'; '\u{26e}'
529 'm', // 'ɯ'; '\u{26f}'
530 'm', // 'ɰ'; '\u{270}'
531 'm', // 'ɱ'; '\u{271}'
532 'n', // 'ɲ'; '\u{272}'
533 'n', // 'ɳ'; '\u{273}'
534 'N', // 'ɴ'; '\u{274}'
535 'o', // 'ɵ'; '\u{275}'
536 'ɶ', // 'ɶ'; '\u{276}'
537 'ɷ', // 'ɷ'; '\u{277}'
538 'ɸ', // 'ɸ'; '\u{278}'
539 'r', // 'ɹ'; '\u{279}'
540 'r', // 'ɺ'; '\u{27a}'
541 'r', // 'ɻ'; '\u{27b}'
542 'r', // 'ɼ'; '\u{27c}'
543 'r', // 'ɽ'; '\u{27d}'
544 'r', // 'ɾ'; '\u{27e}'
545 'r', // 'ɿ'; '\u{27f}'
546 'R', // 'ʀ'; '\u{280}'
547 'R', // 'ʁ'; '\u{281}'
548 's', // 'ʂ'; '\u{282}'
549 'ʃ', // 'ʃ'; '\u{283}'
550 'ʄ', // 'ʄ'; '\u{284}'
551 'ʅ', // 'ʅ'; '\u{285}'
552 'ʆ', // 'ʆ'; '\u{286}'
553 't', // 'ʇ'; '\u{287}'
554 't', // 'ʈ'; '\u{288}'
555 'u', // 'ʉ'; '\u{289}'
556 'ʊ', // 'ʊ'; '\u{28a}'
557 'v', // 'ʋ'; '\u{28b}'
558 'v', // 'ʌ'; '\u{28c}'
559 'w', // 'ʍ'; '\u{28d}'
560 'y', // 'ʎ'; '\u{28e}'
561 'Y', // 'ʏ'; '\u{28f}'
562 'z', // 'ʐ'; '\u{290}'
563 'z', // 'ʑ'; '\u{291}'
564 'ʒ', // 'ʒ'; '\u{292}'
565 'ʓ', // 'ʓ'; '\u{293}'
566 'ʔ', // 'ʔ'; '\u{294}'
567 'ʕ', // 'ʕ'; '\u{295}'
568 'ʖ', // 'ʖ'; '\u{296}'
569 'c', // 'ʗ'; '\u{297}'
570 'ʘ', // 'ʘ'; '\u{298}'
571 'B', // 'ʙ'; '\u{299}'
572 'e', // 'ʚ'; '\u{29a}'
573 'G', // 'ʛ'; '\u{29b}'
574 'H', // 'ʜ'; '\u{29c}'
575 'j', // 'ʝ'; '\u{29d}'
576 'k', // 'ʞ'; '\u{29e}'
577 'L', // 'ʟ'; '\u{29f}'
578];
579
580/// A char array corresponding to the following Unicode block:
581///
582/// - [Latin Extended Additional](https://en.wikipedia.org/wiki/Latin_Extended_Additional)
583///
584/// This covers the range `'\u{1e00}'..='\u{1eff}'`.
585static LATIN_EXTENDED_ADDITIONAL: [char; 256] = [
586 'A', // 'Ḁ'; '\u{1e00}'
587 'a', // 'ḁ'; '\u{1e01}'
588 'B', // 'Ḃ'; '\u{1e02}'
589 'b', // 'ḃ'; '\u{1e03}'
590 'B', // 'Ḅ'; '\u{1e04}'
591 'b', // 'ḅ'; '\u{1e05}'
592 'B', // 'Ḇ'; '\u{1e06}'
593 'b', // 'ḇ'; '\u{1e07}'
594 'C', // 'Ḉ'; '\u{1e08}'
595 'c', // 'ḉ'; '\u{1e09}'
596 'D', // 'Ḋ'; '\u{1e0a}'
597 'e', // 'ḋ'; '\u{1e0b}'
598 'D', // 'Ḍ'; '\u{1e0c}'
599 'd', // 'ḍ'; '\u{1e0d}'
600 'D', // 'Ḏ'; '\u{1e0e}'
601 'd', // 'ḏ'; '\u{1e0f}'
602 'D', // 'Ḑ'; '\u{1e10}'
603 'd', // 'ḑ'; '\u{1e11}'
604 'D', // 'Ḓ'; '\u{1e12}'
605 'd', // 'ḓ'; '\u{1e13}'
606 'E', // 'Ḕ'; '\u{1e14}'
607 'e', // 'ḕ'; '\u{1e15}'
608 'E', // 'Ḗ'; '\u{1e16}'
609 'e', // 'ḗ'; '\u{1e17}'
610 'E', // 'Ḙ'; '\u{1e18}'
611 'e', // 'ḙ'; '\u{1e19}'
612 'E', // 'Ḛ'; '\u{1e1a}'
613 'e', // 'ḛ'; '\u{1e1b}'
614 'E', // 'Ḝ'; '\u{1e1c}'
615 'e', // 'ḝ'; '\u{1e1d}'
616 'F', // 'Ḟ'; '\u{1e1e}'
617 'f', // 'ḟ'; '\u{1e1f}'
618 'G', // 'Ḡ'; '\u{1e20}'
619 'g', // 'ḡ'; '\u{1e21}'
620 'H', // 'Ḣ'; '\u{1e22}'
621 'g', // 'ḣ'; '\u{1e23}'
622 'H', // 'Ḥ'; '\u{1e24}'
623 'g', // 'ḥ'; '\u{1e25}'
624 'H', // 'Ḧ'; '\u{1e26}'
625 'g', // 'ḧ'; '\u{1e27}'
626 'H', // 'Ḩ'; '\u{1e28}'
627 'g', // 'ḩ'; '\u{1e29}'
628 'H', // 'Ḫ'; '\u{1e2a}'
629 'h', // 'ḫ'; '\u{1e2b}'
630 'I', // 'Ḭ'; '\u{1e2c}'
631 'i', // 'ḭ'; '\u{1e2d}'
632 'I', // 'Ḯ'; '\u{1e2e}'
633 'i', // 'ḯ'; '\u{1e2f}'
634 'K', // 'Ḱ'; '\u{1e30}'
635 'k', // 'ḱ'; '\u{1e31}'
636 'K', // 'Ḳ'; '\u{1e32}'
637 'k', // 'ḳ'; '\u{1e33}'
638 'K', // 'Ḵ'; '\u{1e34}'
639 'k', // 'ḵ'; '\u{1e35}'
640 'L', // 'Ḷ'; '\u{1e36}'
641 'l', // 'ḷ'; '\u{1e37}'
642 'L', // 'Ḹ'; '\u{1e38}'
643 'l', // 'ḹ'; '\u{1e39}'
644 'L', // 'Ḻ'; '\u{1e3a}'
645 'l', // 'ḻ'; '\u{1e3b}'
646 'L', // 'Ḽ'; '\u{1e3c}'
647 'l', // 'ḽ'; '\u{1e3d}'
648 'M', // 'Ḿ'; '\u{1e3e}'
649 'm', // 'ḿ'; '\u{1e3f}'
650 'M', // 'Ṁ'; '\u{1e40}'
651 'm', // 'ṁ'; '\u{1e41}'
652 'M', // 'Ṃ'; '\u{1e42}'
653 'm', // 'ṃ'; '\u{1e43}'
654 'N', // 'Ṅ'; '\u{1e44}'
655 'n', // 'ṅ'; '\u{1e45}'
656 'N', // 'Ṇ'; '\u{1e46}'
657 'n', // 'ṇ'; '\u{1e47}'
658 'N', // 'Ṉ'; '\u{1e48}'
659 'n', // 'ṉ'; '\u{1e49}'
660 'N', // 'Ṋ'; '\u{1e4a}'
661 'n', // 'ṋ'; '\u{1e4b}'
662 'O', // 'Ṍ'; '\u{1e4c}'
663 'o', // 'ṍ'; '\u{1e4d}'
664 'O', // 'Ṏ'; '\u{1e4e}'
665 'o', // 'ṏ'; '\u{1e4f}'
666 'O', // 'Ṑ'; '\u{1e50}'
667 'o', // 'ṑ'; '\u{1e51}'
668 'O', // 'Ṓ'; '\u{1e52}'
669 'o', // 'ṓ'; '\u{1e53}'
670 'P', // 'Ṕ'; '\u{1e54}'
671 'p', // 'ṕ'; '\u{1e55}'
672 'P', // 'Ṗ'; '\u{1e56}'
673 'p', // 'ṗ'; '\u{1e57}'
674 'R', // 'Ṙ'; '\u{1e58}'
675 'r', // 'ṙ'; '\u{1e59}'
676 'R', // 'Ṛ'; '\u{1e5a}'
677 'r', // 'ṛ'; '\u{1e5b}'
678 'R', // 'Ṝ'; '\u{1e5c}'
679 'r', // 'ṝ'; '\u{1e5d}'
680 'R', // 'Ṟ'; '\u{1e5e}'
681 'r', // 'ṟ'; '\u{1e5f}'
682 'S', // 'Ṡ'; '\u{1e60}'
683 's', // 'ṡ'; '\u{1e61}'
684 'S', // 'Ṣ'; '\u{1e62}'
685 's', // 'ṣ'; '\u{1e63}'
686 'S', // 'Ṥ'; '\u{1e64}'
687 's', // 'ṥ'; '\u{1e65}'
688 'S', // 'Ṧ'; '\u{1e66}'
689 's', // 'ṧ'; '\u{1e67}'
690 'S', // 'Ṩ'; '\u{1e68}'
691 's', // 'ṩ'; '\u{1e69}'
692 'T', // 'Ṫ'; '\u{1e6a}'
693 't', // 'ṫ'; '\u{1e6b}'
694 'T', // 'Ṭ'; '\u{1e6c}'
695 't', // 'ṭ'; '\u{1e6d}'
696 'T', // 'Ṯ'; '\u{1e6e}'
697 't', // 'ṯ'; '\u{1e6f}'
698 'T', // 'Ṱ'; '\u{1e70}'
699 't', // 'ṱ'; '\u{1e71}'
700 'U', // 'Ṳ'; '\u{1e72}'
701 'u', // 'ṳ'; '\u{1e73}'
702 'U', // 'Ṵ'; '\u{1e74}'
703 'u', // 'ṵ'; '\u{1e75}'
704 'U', // 'Ṷ'; '\u{1e76}'
705 'u', // 'ṷ'; '\u{1e77}'
706 'U', // 'Ṹ'; '\u{1e78}'
707 'u', // 'ṹ'; '\u{1e79}'
708 'U', // 'Ṻ'; '\u{1e7a}'
709 'u', // 'ṻ'; '\u{1e7b}'
710 'V', // 'Ṽ'; '\u{1e7c}'
711 'v', // 'ṽ'; '\u{1e7d}'
712 'V', // 'Ṿ'; '\u{1e7e}'
713 'v', // 'ṿ'; '\u{1e7f}'
714 'W', // 'Ẁ'; '\u{1e80}'
715 'w', // 'ẁ'; '\u{1e81}'
716 'W', // 'Ẃ'; '\u{1e82}'
717 'w', // 'ẃ'; '\u{1e83}'
718 'W', // 'Ẅ'; '\u{1e84}'
719 'w', // 'ẅ'; '\u{1e85}'
720 'W', // 'Ẇ'; '\u{1e86}'
721 'w', // 'ẇ'; '\u{1e87}'
722 'W', // 'Ẉ'; '\u{1e88}'
723 'j', // 'ẉ'; '\u{1e89}'
724 'X', // 'Ẋ'; '\u{1e8a}'
725 'x', // 'ẋ'; '\u{1e8b}'
726 'X', // 'Ẍ'; '\u{1e8c}'
727 'x', // 'ẍ'; '\u{1e8d}'
728 'Y', // 'Ẏ'; '\u{1e8e}'
729 'y', // 'ẏ'; '\u{1e8f}'
730 'Z', // 'Ẑ'; '\u{1e90}'
731 'z', // 'ẑ'; '\u{1e91}'
732 'Z', // 'Ẓ'; '\u{1e92}'
733 'z', // 'ẓ'; '\u{1e93}'
734 'Z', // 'Ẕ'; '\u{1e94}'
735 'z', // 'ẕ'; '\u{1e95}'
736 'h', // 'ẖ'; '\u{1e96}'
737 't', // 'ẗ'; '\u{1e97}'
738 'w', // 'ẘ'; '\u{1e98}'
739 'y', // 'ẙ'; '\u{1e99}'
740 'a', // 'ẚ'; '\u{1e9a}'
741 'i', // 'ẛ'; '\u{1e9b}'
742 'f', // 'ẜ'; '\u{1e9c}'
743 'f', // 'ẝ'; '\u{1e9d}'
744 'ẞ', // 'ẞ'; '\u{1e9e}'
745 'ẟ', // 'ẟ'; '\u{1e9f}'
746 'A', // 'Ạ'; '\u{1ea0}'
747 'a', // 'ạ'; '\u{1ea1}'
748 'A', // 'Ả'; '\u{1ea2}'
749 'a', // 'ả'; '\u{1ea3}'
750 'A', // 'Ấ'; '\u{1ea4}'
751 'a', // 'ấ'; '\u{1ea5}'
752 'A', // 'Ầ'; '\u{1ea6}'
753 'a', // 'ầ'; '\u{1ea7}'
754 'A', // 'Ẩ'; '\u{1ea8}'
755 'a', // 'ẩ'; '\u{1ea9}'
756 'A', // 'Ẫ'; '\u{1eaa}'
757 'a', // 'ẫ'; '\u{1eab}'
758 'A', // 'Ậ'; '\u{1eac}'
759 'a', // 'ậ'; '\u{1ead}'
760 'A', // 'Ắ'; '\u{1eae}'
761 'a', // 'ắ'; '\u{1eaf}'
762 'A', // 'Ằ'; '\u{1eb0}'
763 'a', // 'ằ'; '\u{1eb1}'
764 'A', // 'Ẳ'; '\u{1eb2}'
765 'a', // 'ẳ'; '\u{1eb3}'
766 'A', // 'Ẵ'; '\u{1eb4}'
767 'a', // 'ẵ'; '\u{1eb5}'
768 'A', // 'Ặ'; '\u{1eb6}'
769 'a', // 'ặ'; '\u{1eb7}'
770 'E', // 'Ẹ'; '\u{1eb8}'
771 'e', // 'ẹ'; '\u{1eb9}'
772 'E', // 'Ẻ'; '\u{1eba}'
773 'e', // 'ẻ'; '\u{1ebb}'
774 'E', // 'Ẽ'; '\u{1ebc}'
775 'e', // 'ẽ'; '\u{1ebd}'
776 'E', // 'Ế'; '\u{1ebe}'
777 'e', // 'ế'; '\u{1ebf}'
778 'E', // 'Ề'; '\u{1ec0}'
779 'e', // 'ề'; '\u{1ec1}'
780 'E', // 'Ể'; '\u{1ec2}'
781 'e', // 'ể'; '\u{1ec3}'
782 'E', // 'Ễ'; '\u{1ec4}'
783 'e', // 'ễ'; '\u{1ec5}'
784 'E', // 'Ệ'; '\u{1ec6}'
785 'e', // 'ệ'; '\u{1ec7}'
786 'I', // 'Ỉ'; '\u{1ec8}'
787 'i', // 'ỉ'; '\u{1ec9}'
788 'I', // 'Ị'; '\u{1eca}'
789 'i', // 'ị'; '\u{1ecb}'
790 'O', // 'Ọ'; '\u{1ecc}'
791 'o', // 'ọ'; '\u{1ecd}'
792 'O', // 'Ỏ'; '\u{1ece}'
793 'o', // 'ỏ'; '\u{1ecf}'
794 'O', // 'Ố'; '\u{1ed0}'
795 'o', // 'ố'; '\u{1ed1}'
796 'O', // 'Ồ'; '\u{1ed2}'
797 'o', // 'ồ'; '\u{1ed3}'
798 'O', // 'Ổ'; '\u{1ed4}'
799 'o', // 'ổ'; '\u{1ed5}'
800 'O', // 'Ỗ'; '\u{1ed6}'
801 'o', // 'ỗ'; '\u{1ed7}'
802 'O', // 'Ộ'; '\u{1ed8}'
803 'o', // 'ộ'; '\u{1ed9}'
804 'O', // 'Ớ'; '\u{1eda}'
805 'o', // 'ớ'; '\u{1edb}'
806 'O', // 'Ờ'; '\u{1edc}'
807 'o', // 'ờ'; '\u{1edd}'
808 'O', // 'Ở'; '\u{1ede}'
809 'o', // 'ở'; '\u{1edf}'
810 'O', // 'Ỡ'; '\u{1ee0}'
811 'o', // 'ỡ'; '\u{1ee1}'
812 'O', // 'Ợ'; '\u{1ee2}'
813 'o', // 'ợ'; '\u{1ee3}'
814 'U', // 'Ụ'; '\u{1ee4}'
815 'u', // 'ụ'; '\u{1ee5}'
816 'U', // 'Ủ'; '\u{1ee6}'
817 'u', // 'ủ'; '\u{1ee7}'
818 'U', // 'Ứ'; '\u{1ee8}'
819 'u', // 'ứ'; '\u{1ee9}'
820 'U', // 'Ừ'; '\u{1eea}'
821 'u', // 'ừ'; '\u{1eeb}'
822 'U', // 'Ử'; '\u{1eec}'
823 'u', // 'ử'; '\u{1eed}'
824 'U', // 'Ữ'; '\u{1eee}'
825 'u', // 'ữ'; '\u{1eef}'
826 'U', // 'Ự'; '\u{1ef0}'
827 'u', // 'ự'; '\u{1ef1}'
828 'Y', // 'Ỳ'; '\u{1ef2}'
829 'y', // 'ỳ'; '\u{1ef3}'
830 'Y', // 'Ỵ'; '\u{1ef4}'
831 'y', // 'ỵ'; '\u{1ef5}'
832 'Y', // 'Ỷ'; '\u{1ef6}'
833 'y', // 'ỷ'; '\u{1ef7}'
834 'Y', // 'Ỹ'; '\u{1ef8}'
835 'y', // 'ỹ'; '\u{1ef9}'
836 'Ỻ', // 'Ỻ'; '\u{1efa}'
837 'ỻ', // 'ỻ'; '\u{1efb}'
838 'Ỽ', // 'Ỽ'; '\u{1efc}'
839 'ỽ', // 'ỽ'; '\u{1efd}'
840 'Ỿ', // 'Ỿ'; '\u{1efe}'
841 'ỿ', // 'ỿ'; '\u{1eff}'
842];
843
844/// A char array corresponding to the following Unicode block:
845///
846/// - [Superscripts and Subscripts](https://en.wikipedia.org/wiki/Superscripts_and_Subscripts)
847///
848/// This covers the range `'\u{2070}'..='\u{209f}'`.
849static SUPERSCRIPTS_AND_SUBSCRIPTS: [char; 48] = [
850 '0', // '⁰'; '\u{2070}'
851 'i', // 'ⁱ'; '\u{2071}'
852 '', // ''; '\u{2072}'
853 '', // ''; '\u{2073}'
854 '4', // '⁴'; '\u{2074}'
855 '5', // '⁵'; '\u{2075}'
856 '6', // '⁶'; '\u{2076}'
857 '7', // '⁷'; '\u{2077}'
858 '8', // '⁸'; '\u{2078}'
859 '0', // '⁹'; '\u{2079}'
860 '+', // '⁺'; '\u{207a}'
861 '-', // '⁻'; '\u{207b}'
862 '=', // '⁼'; '\u{207c}'
863 '(', // '⁽'; '\u{207d}'
864 ')', // '⁾'; '\u{207e}'
865 'n', // 'ⁿ'; '\u{207f}'
866 '0', // '₀'; '\u{2080}'
867 '1', // '₁'; '\u{2081}'
868 '2', // '₂'; '\u{2082}'
869 '3', // '₃'; '\u{2083}'
870 '4', // '₄'; '\u{2084}'
871 '5', // '₅'; '\u{2085}'
872 '6', // '₆'; '\u{2086}'
873 '7', // '₇'; '\u{2087}'
874 '8', // '₈'; '\u{2088}'
875 '9', // '₉'; '\u{2089}'
876 '+', // '₊'; '\u{208a}'
877 '-', // '₋'; '\u{208b}'
878 '=', // '₌'; '\u{208c}'
879 '(', // '₍'; '\u{208d}'
880 ')', // '₎'; '\u{208e}'
881 '', // ''; '\u{208f}'
882 'a', // 'ₐ'; '\u{2090}'
883 'e', // 'ₑ'; '\u{2091}'
884 'o', // 'ₒ'; '\u{2092}'
885 'x', // 'ₓ'; '\u{2093}'
886 'e', // 'ₔ'; '\u{2094}'
887 'h', // 'ₕ'; '\u{2095}'
888 'k', // 'ₖ'; '\u{2096}'
889 'l', // 'ₗ'; '\u{2097}'
890 'm', // 'ₘ'; '\u{2098}'
891 'n', // 'ₙ'; '\u{2099}'
892 'p', // 'ₚ'; '\u{209a}'
893 's', // 'ₛ'; '\u{209b}'
894 't', // 'ₜ'; '\u{209c}'
895 '', // ''; '\u{209d}'
896 '', // ''; '\u{209e}'
897 '', // ''; '\u{209f}'
898];
899
900#[cfg(test)]
901mod tests {
902 use rstest::rstest;
903
904 use super::*;
905
906 /// Helper function for test assertions.
907 fn check_conversions(pairs: &[(char, char)]) {
908 for (original, normalized) in pairs {
909 assert_eq!(normalize(*original), *normalized);
910 }
911 }
912
913 /// General conversion checks
914 #[rstest]
915 fn general() {
916 check_conversions(&[
917 ('ą', 'a'),
918 ('À', 'A'),
919 ('ć', 'c'),
920 ('ę', 'e'),
921 ('ł', 'l'),
922 ('ń', 'n'),
923 ('ó', 'o'),
924 ('ś', 's'),
925 ('ź', 'z'),
926 ('ż', 'z'),
927 ('Ą', 'A'),
928 ('Ć', 'C'),
929 ('Ę', 'E'),
930 ('ł', 'l'),
931 ('Ł', 'L'),
932 ('Ń', 'N'),
933 ('Ó', 'O'),
934 ('Ś', 'S'),
935 ('Ź', 'Z'),
936 ('Ż', 'Z'),
937 ('¡', '!'),
938 ]);
939 }
940
941 /// Some checks for characters which are not visible.
942 #[rstest]
943 fn invisible_chars() {
944 check_conversions(&[('\u{a0}', '\u{a0}'), ('\u{ad}', '\u{ad}')]);
945 }
946
947 /// Check boundary cases in case ranges are modified.
948 #[rstest]
949 fn boundary_cases() {
950 check_conversions(&[
951 ('\u{9f}', '\u{9f}'),
952 ('\u{a0}', '\u{a0}'),
953 ('¡', '!'),
954 ('ʟ', 'L'),
955 ('\u{2a0}', '\u{2a0}'),
956 ('\u{1dff}', '\u{1dff}'),
957 ('Ḁ', 'A'),
958 ('ỹ', 'y'),
959 ('\u{1eff}', '\u{1eff}'),
960 ('\u{1f00}', '\u{1f00}'),
961 ('⁰', '0'),
962 ('\u{209c}', 't'),
963 ('\u{209f}', '\u{209f}'),
964 ('\u{20a0}', '\u{20a0}'),
965 ]);
966 }
967
968 /// Check that conversions outside the blocks are unchanged.
969 #[rstest]
970 fn unchanged_outside_blocks() {
971 check_conversions(&[
972 ('a', 'a'),
973 ('⟁', '⟁'),
974 ('┍', '┍'),
975 ('ω', 'ω'),
976 ('⁕', '⁕'),
977 ('ה', 'ה'),
978 ]);
979 }
980}