Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
encoding.c
1 #include "prism/encoding.h"
2 
3 typedef uint32_t pm_unicode_codepoint_t;
4 
5 #define UNICODE_ALPHA_CODEPOINTS_LENGTH 1450
6 static const pm_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_LENGTH] = {
7  0x100, 0x2C1,
8  0x2C6, 0x2D1,
9  0x2E0, 0x2E4,
10  0x2EC, 0x2EC,
11  0x2EE, 0x2EE,
12  0x345, 0x345,
13  0x370, 0x374,
14  0x376, 0x377,
15  0x37A, 0x37D,
16  0x37F, 0x37F,
17  0x386, 0x386,
18  0x388, 0x38A,
19  0x38C, 0x38C,
20  0x38E, 0x3A1,
21  0x3A3, 0x3F5,
22  0x3F7, 0x481,
23  0x48A, 0x52F,
24  0x531, 0x556,
25  0x559, 0x559,
26  0x560, 0x588,
27  0x5B0, 0x5BD,
28  0x5BF, 0x5BF,
29  0x5C1, 0x5C2,
30  0x5C4, 0x5C5,
31  0x5C7, 0x5C7,
32  0x5D0, 0x5EA,
33  0x5EF, 0x5F2,
34  0x610, 0x61A,
35  0x620, 0x657,
36  0x659, 0x65F,
37  0x66E, 0x6D3,
38  0x6D5, 0x6DC,
39  0x6E1, 0x6E8,
40  0x6ED, 0x6EF,
41  0x6FA, 0x6FC,
42  0x6FF, 0x6FF,
43  0x710, 0x73F,
44  0x74D, 0x7B1,
45  0x7CA, 0x7EA,
46  0x7F4, 0x7F5,
47  0x7FA, 0x7FA,
48  0x800, 0x817,
49  0x81A, 0x82C,
50  0x840, 0x858,
51  0x860, 0x86A,
52  0x870, 0x887,
53  0x889, 0x88E,
54  0x8A0, 0x8C9,
55  0x8D4, 0x8DF,
56  0x8E3, 0x8E9,
57  0x8F0, 0x93B,
58  0x93D, 0x94C,
59  0x94E, 0x950,
60  0x955, 0x963,
61  0x971, 0x983,
62  0x985, 0x98C,
63  0x98F, 0x990,
64  0x993, 0x9A8,
65  0x9AA, 0x9B0,
66  0x9B2, 0x9B2,
67  0x9B6, 0x9B9,
68  0x9BD, 0x9C4,
69  0x9C7, 0x9C8,
70  0x9CB, 0x9CC,
71  0x9CE, 0x9CE,
72  0x9D7, 0x9D7,
73  0x9DC, 0x9DD,
74  0x9DF, 0x9E3,
75  0x9F0, 0x9F1,
76  0x9FC, 0x9FC,
77  0xA01, 0xA03,
78  0xA05, 0xA0A,
79  0xA0F, 0xA10,
80  0xA13, 0xA28,
81  0xA2A, 0xA30,
82  0xA32, 0xA33,
83  0xA35, 0xA36,
84  0xA38, 0xA39,
85  0xA3E, 0xA42,
86  0xA47, 0xA48,
87  0xA4B, 0xA4C,
88  0xA51, 0xA51,
89  0xA59, 0xA5C,
90  0xA5E, 0xA5E,
91  0xA70, 0xA75,
92  0xA81, 0xA83,
93  0xA85, 0xA8D,
94  0xA8F, 0xA91,
95  0xA93, 0xAA8,
96  0xAAA, 0xAB0,
97  0xAB2, 0xAB3,
98  0xAB5, 0xAB9,
99  0xABD, 0xAC5,
100  0xAC7, 0xAC9,
101  0xACB, 0xACC,
102  0xAD0, 0xAD0,
103  0xAE0, 0xAE3,
104  0xAF9, 0xAFC,
105  0xB01, 0xB03,
106  0xB05, 0xB0C,
107  0xB0F, 0xB10,
108  0xB13, 0xB28,
109  0xB2A, 0xB30,
110  0xB32, 0xB33,
111  0xB35, 0xB39,
112  0xB3D, 0xB44,
113  0xB47, 0xB48,
114  0xB4B, 0xB4C,
115  0xB56, 0xB57,
116  0xB5C, 0xB5D,
117  0xB5F, 0xB63,
118  0xB71, 0xB71,
119  0xB82, 0xB83,
120  0xB85, 0xB8A,
121  0xB8E, 0xB90,
122  0xB92, 0xB95,
123  0xB99, 0xB9A,
124  0xB9C, 0xB9C,
125  0xB9E, 0xB9F,
126  0xBA3, 0xBA4,
127  0xBA8, 0xBAA,
128  0xBAE, 0xBB9,
129  0xBBE, 0xBC2,
130  0xBC6, 0xBC8,
131  0xBCA, 0xBCC,
132  0xBD0, 0xBD0,
133  0xBD7, 0xBD7,
134  0xC00, 0xC0C,
135  0xC0E, 0xC10,
136  0xC12, 0xC28,
137  0xC2A, 0xC39,
138  0xC3D, 0xC44,
139  0xC46, 0xC48,
140  0xC4A, 0xC4C,
141  0xC55, 0xC56,
142  0xC58, 0xC5A,
143  0xC5D, 0xC5D,
144  0xC60, 0xC63,
145  0xC80, 0xC83,
146  0xC85, 0xC8C,
147  0xC8E, 0xC90,
148  0xC92, 0xCA8,
149  0xCAA, 0xCB3,
150  0xCB5, 0xCB9,
151  0xCBD, 0xCC4,
152  0xCC6, 0xCC8,
153  0xCCA, 0xCCC,
154  0xCD5, 0xCD6,
155  0xCDD, 0xCDE,
156  0xCE0, 0xCE3,
157  0xCF1, 0xCF3,
158  0xD00, 0xD0C,
159  0xD0E, 0xD10,
160  0xD12, 0xD3A,
161  0xD3D, 0xD44,
162  0xD46, 0xD48,
163  0xD4A, 0xD4C,
164  0xD4E, 0xD4E,
165  0xD54, 0xD57,
166  0xD5F, 0xD63,
167  0xD7A, 0xD7F,
168  0xD81, 0xD83,
169  0xD85, 0xD96,
170  0xD9A, 0xDB1,
171  0xDB3, 0xDBB,
172  0xDBD, 0xDBD,
173  0xDC0, 0xDC6,
174  0xDCF, 0xDD4,
175  0xDD6, 0xDD6,
176  0xDD8, 0xDDF,
177  0xDF2, 0xDF3,
178  0xE01, 0xE3A,
179  0xE40, 0xE46,
180  0xE4D, 0xE4D,
181  0xE81, 0xE82,
182  0xE84, 0xE84,
183  0xE86, 0xE8A,
184  0xE8C, 0xEA3,
185  0xEA5, 0xEA5,
186  0xEA7, 0xEB9,
187  0xEBB, 0xEBD,
188  0xEC0, 0xEC4,
189  0xEC6, 0xEC6,
190  0xECD, 0xECD,
191  0xEDC, 0xEDF,
192  0xF00, 0xF00,
193  0xF40, 0xF47,
194  0xF49, 0xF6C,
195  0xF71, 0xF83,
196  0xF88, 0xF97,
197  0xF99, 0xFBC,
198  0x1000, 0x1036,
199  0x1038, 0x1038,
200  0x103B, 0x103F,
201  0x1050, 0x108F,
202  0x109A, 0x109D,
203  0x10A0, 0x10C5,
204  0x10C7, 0x10C7,
205  0x10CD, 0x10CD,
206  0x10D0, 0x10FA,
207  0x10FC, 0x1248,
208  0x124A, 0x124D,
209  0x1250, 0x1256,
210  0x1258, 0x1258,
211  0x125A, 0x125D,
212  0x1260, 0x1288,
213  0x128A, 0x128D,
214  0x1290, 0x12B0,
215  0x12B2, 0x12B5,
216  0x12B8, 0x12BE,
217  0x12C0, 0x12C0,
218  0x12C2, 0x12C5,
219  0x12C8, 0x12D6,
220  0x12D8, 0x1310,
221  0x1312, 0x1315,
222  0x1318, 0x135A,
223  0x1380, 0x138F,
224  0x13A0, 0x13F5,
225  0x13F8, 0x13FD,
226  0x1401, 0x166C,
227  0x166F, 0x167F,
228  0x1681, 0x169A,
229  0x16A0, 0x16EA,
230  0x16EE, 0x16F8,
231  0x1700, 0x1713,
232  0x171F, 0x1733,
233  0x1740, 0x1753,
234  0x1760, 0x176C,
235  0x176E, 0x1770,
236  0x1772, 0x1773,
237  0x1780, 0x17B3,
238  0x17B6, 0x17C8,
239  0x17D7, 0x17D7,
240  0x17DC, 0x17DC,
241  0x1820, 0x1878,
242  0x1880, 0x18AA,
243  0x18B0, 0x18F5,
244  0x1900, 0x191E,
245  0x1920, 0x192B,
246  0x1930, 0x1938,
247  0x1950, 0x196D,
248  0x1970, 0x1974,
249  0x1980, 0x19AB,
250  0x19B0, 0x19C9,
251  0x1A00, 0x1A1B,
252  0x1A20, 0x1A5E,
253  0x1A61, 0x1A74,
254  0x1AA7, 0x1AA7,
255  0x1ABF, 0x1AC0,
256  0x1ACC, 0x1ACE,
257  0x1B00, 0x1B33,
258  0x1B35, 0x1B43,
259  0x1B45, 0x1B4C,
260  0x1B80, 0x1BA9,
261  0x1BAC, 0x1BAF,
262  0x1BBA, 0x1BE5,
263  0x1BE7, 0x1BF1,
264  0x1C00, 0x1C36,
265  0x1C4D, 0x1C4F,
266  0x1C5A, 0x1C7D,
267  0x1C80, 0x1C88,
268  0x1C90, 0x1CBA,
269  0x1CBD, 0x1CBF,
270  0x1CE9, 0x1CEC,
271  0x1CEE, 0x1CF3,
272  0x1CF5, 0x1CF6,
273  0x1CFA, 0x1CFA,
274  0x1D00, 0x1DBF,
275  0x1DE7, 0x1DF4,
276  0x1E00, 0x1F15,
277  0x1F18, 0x1F1D,
278  0x1F20, 0x1F45,
279  0x1F48, 0x1F4D,
280  0x1F50, 0x1F57,
281  0x1F59, 0x1F59,
282  0x1F5B, 0x1F5B,
283  0x1F5D, 0x1F5D,
284  0x1F5F, 0x1F7D,
285  0x1F80, 0x1FB4,
286  0x1FB6, 0x1FBC,
287  0x1FBE, 0x1FBE,
288  0x1FC2, 0x1FC4,
289  0x1FC6, 0x1FCC,
290  0x1FD0, 0x1FD3,
291  0x1FD6, 0x1FDB,
292  0x1FE0, 0x1FEC,
293  0x1FF2, 0x1FF4,
294  0x1FF6, 0x1FFC,
295  0x2071, 0x2071,
296  0x207F, 0x207F,
297  0x2090, 0x209C,
298  0x2102, 0x2102,
299  0x2107, 0x2107,
300  0x210A, 0x2113,
301  0x2115, 0x2115,
302  0x2119, 0x211D,
303  0x2124, 0x2124,
304  0x2126, 0x2126,
305  0x2128, 0x2128,
306  0x212A, 0x212D,
307  0x212F, 0x2139,
308  0x213C, 0x213F,
309  0x2145, 0x2149,
310  0x214E, 0x214E,
311  0x2160, 0x2188,
312  0x24B6, 0x24E9,
313  0x2C00, 0x2CE4,
314  0x2CEB, 0x2CEE,
315  0x2CF2, 0x2CF3,
316  0x2D00, 0x2D25,
317  0x2D27, 0x2D27,
318  0x2D2D, 0x2D2D,
319  0x2D30, 0x2D67,
320  0x2D6F, 0x2D6F,
321  0x2D80, 0x2D96,
322  0x2DA0, 0x2DA6,
323  0x2DA8, 0x2DAE,
324  0x2DB0, 0x2DB6,
325  0x2DB8, 0x2DBE,
326  0x2DC0, 0x2DC6,
327  0x2DC8, 0x2DCE,
328  0x2DD0, 0x2DD6,
329  0x2DD8, 0x2DDE,
330  0x2DE0, 0x2DFF,
331  0x2E2F, 0x2E2F,
332  0x3005, 0x3007,
333  0x3021, 0x3029,
334  0x3031, 0x3035,
335  0x3038, 0x303C,
336  0x3041, 0x3096,
337  0x309D, 0x309F,
338  0x30A1, 0x30FA,
339  0x30FC, 0x30FF,
340  0x3105, 0x312F,
341  0x3131, 0x318E,
342  0x31A0, 0x31BF,
343  0x31F0, 0x31FF,
344  0x3400, 0x4DBF,
345  0x4E00, 0xA48C,
346  0xA4D0, 0xA4FD,
347  0xA500, 0xA60C,
348  0xA610, 0xA61F,
349  0xA62A, 0xA62B,
350  0xA640, 0xA66E,
351  0xA674, 0xA67B,
352  0xA67F, 0xA6EF,
353  0xA717, 0xA71F,
354  0xA722, 0xA788,
355  0xA78B, 0xA7CA,
356  0xA7D0, 0xA7D1,
357  0xA7D3, 0xA7D3,
358  0xA7D5, 0xA7D9,
359  0xA7F2, 0xA805,
360  0xA807, 0xA827,
361  0xA840, 0xA873,
362  0xA880, 0xA8C3,
363  0xA8C5, 0xA8C5,
364  0xA8F2, 0xA8F7,
365  0xA8FB, 0xA8FB,
366  0xA8FD, 0xA8FF,
367  0xA90A, 0xA92A,
368  0xA930, 0xA952,
369  0xA960, 0xA97C,
370  0xA980, 0xA9B2,
371  0xA9B4, 0xA9BF,
372  0xA9CF, 0xA9CF,
373  0xA9E0, 0xA9EF,
374  0xA9FA, 0xA9FE,
375  0xAA00, 0xAA36,
376  0xAA40, 0xAA4D,
377  0xAA60, 0xAA76,
378  0xAA7A, 0xAABE,
379  0xAAC0, 0xAAC0,
380  0xAAC2, 0xAAC2,
381  0xAADB, 0xAADD,
382  0xAAE0, 0xAAEF,
383  0xAAF2, 0xAAF5,
384  0xAB01, 0xAB06,
385  0xAB09, 0xAB0E,
386  0xAB11, 0xAB16,
387  0xAB20, 0xAB26,
388  0xAB28, 0xAB2E,
389  0xAB30, 0xAB5A,
390  0xAB5C, 0xAB69,
391  0xAB70, 0xABEA,
392  0xAC00, 0xD7A3,
393  0xD7B0, 0xD7C6,
394  0xD7CB, 0xD7FB,
395  0xF900, 0xFA6D,
396  0xFA70, 0xFAD9,
397  0xFB00, 0xFB06,
398  0xFB13, 0xFB17,
399  0xFB1D, 0xFB28,
400  0xFB2A, 0xFB36,
401  0xFB38, 0xFB3C,
402  0xFB3E, 0xFB3E,
403  0xFB40, 0xFB41,
404  0xFB43, 0xFB44,
405  0xFB46, 0xFBB1,
406  0xFBD3, 0xFD3D,
407  0xFD50, 0xFD8F,
408  0xFD92, 0xFDC7,
409  0xFDF0, 0xFDFB,
410  0xFE70, 0xFE74,
411  0xFE76, 0xFEFC,
412  0xFF21, 0xFF3A,
413  0xFF41, 0xFF5A,
414  0xFF66, 0xFFBE,
415  0xFFC2, 0xFFC7,
416  0xFFCA, 0xFFCF,
417  0xFFD2, 0xFFD7,
418  0xFFDA, 0xFFDC,
419  0x10000, 0x1000B,
420  0x1000D, 0x10026,
421  0x10028, 0x1003A,
422  0x1003C, 0x1003D,
423  0x1003F, 0x1004D,
424  0x10050, 0x1005D,
425  0x10080, 0x100FA,
426  0x10140, 0x10174,
427  0x10280, 0x1029C,
428  0x102A0, 0x102D0,
429  0x10300, 0x1031F,
430  0x1032D, 0x1034A,
431  0x10350, 0x1037A,
432  0x10380, 0x1039D,
433  0x103A0, 0x103C3,
434  0x103C8, 0x103CF,
435  0x103D1, 0x103D5,
436  0x10400, 0x1049D,
437  0x104B0, 0x104D3,
438  0x104D8, 0x104FB,
439  0x10500, 0x10527,
440  0x10530, 0x10563,
441  0x10570, 0x1057A,
442  0x1057C, 0x1058A,
443  0x1058C, 0x10592,
444  0x10594, 0x10595,
445  0x10597, 0x105A1,
446  0x105A3, 0x105B1,
447  0x105B3, 0x105B9,
448  0x105BB, 0x105BC,
449  0x10600, 0x10736,
450  0x10740, 0x10755,
451  0x10760, 0x10767,
452  0x10780, 0x10785,
453  0x10787, 0x107B0,
454  0x107B2, 0x107BA,
455  0x10800, 0x10805,
456  0x10808, 0x10808,
457  0x1080A, 0x10835,
458  0x10837, 0x10838,
459  0x1083C, 0x1083C,
460  0x1083F, 0x10855,
461  0x10860, 0x10876,
462  0x10880, 0x1089E,
463  0x108E0, 0x108F2,
464  0x108F4, 0x108F5,
465  0x10900, 0x10915,
466  0x10920, 0x10939,
467  0x10980, 0x109B7,
468  0x109BE, 0x109BF,
469  0x10A00, 0x10A03,
470  0x10A05, 0x10A06,
471  0x10A0C, 0x10A13,
472  0x10A15, 0x10A17,
473  0x10A19, 0x10A35,
474  0x10A60, 0x10A7C,
475  0x10A80, 0x10A9C,
476  0x10AC0, 0x10AC7,
477  0x10AC9, 0x10AE4,
478  0x10B00, 0x10B35,
479  0x10B40, 0x10B55,
480  0x10B60, 0x10B72,
481  0x10B80, 0x10B91,
482  0x10C00, 0x10C48,
483  0x10C80, 0x10CB2,
484  0x10CC0, 0x10CF2,
485  0x10D00, 0x10D27,
486  0x10E80, 0x10EA9,
487  0x10EAB, 0x10EAC,
488  0x10EB0, 0x10EB1,
489  0x10F00, 0x10F1C,
490  0x10F27, 0x10F27,
491  0x10F30, 0x10F45,
492  0x10F70, 0x10F81,
493  0x10FB0, 0x10FC4,
494  0x10FE0, 0x10FF6,
495  0x11000, 0x11045,
496  0x11071, 0x11075,
497  0x11080, 0x110B8,
498  0x110C2, 0x110C2,
499  0x110D0, 0x110E8,
500  0x11100, 0x11132,
501  0x11144, 0x11147,
502  0x11150, 0x11172,
503  0x11176, 0x11176,
504  0x11180, 0x111BF,
505  0x111C1, 0x111C4,
506  0x111CE, 0x111CF,
507  0x111DA, 0x111DA,
508  0x111DC, 0x111DC,
509  0x11200, 0x11211,
510  0x11213, 0x11234,
511  0x11237, 0x11237,
512  0x1123E, 0x11241,
513  0x11280, 0x11286,
514  0x11288, 0x11288,
515  0x1128A, 0x1128D,
516  0x1128F, 0x1129D,
517  0x1129F, 0x112A8,
518  0x112B0, 0x112E8,
519  0x11300, 0x11303,
520  0x11305, 0x1130C,
521  0x1130F, 0x11310,
522  0x11313, 0x11328,
523  0x1132A, 0x11330,
524  0x11332, 0x11333,
525  0x11335, 0x11339,
526  0x1133D, 0x11344,
527  0x11347, 0x11348,
528  0x1134B, 0x1134C,
529  0x11350, 0x11350,
530  0x11357, 0x11357,
531  0x1135D, 0x11363,
532  0x11400, 0x11441,
533  0x11443, 0x11445,
534  0x11447, 0x1144A,
535  0x1145F, 0x11461,
536  0x11480, 0x114C1,
537  0x114C4, 0x114C5,
538  0x114C7, 0x114C7,
539  0x11580, 0x115B5,
540  0x115B8, 0x115BE,
541  0x115D8, 0x115DD,
542  0x11600, 0x1163E,
543  0x11640, 0x11640,
544  0x11644, 0x11644,
545  0x11680, 0x116B5,
546  0x116B8, 0x116B8,
547  0x11700, 0x1171A,
548  0x1171D, 0x1172A,
549  0x11740, 0x11746,
550  0x11800, 0x11838,
551  0x118A0, 0x118DF,
552  0x118FF, 0x11906,
553  0x11909, 0x11909,
554  0x1190C, 0x11913,
555  0x11915, 0x11916,
556  0x11918, 0x11935,
557  0x11937, 0x11938,
558  0x1193B, 0x1193C,
559  0x1193F, 0x11942,
560  0x119A0, 0x119A7,
561  0x119AA, 0x119D7,
562  0x119DA, 0x119DF,
563  0x119E1, 0x119E1,
564  0x119E3, 0x119E4,
565  0x11A00, 0x11A32,
566  0x11A35, 0x11A3E,
567  0x11A50, 0x11A97,
568  0x11A9D, 0x11A9D,
569  0x11AB0, 0x11AF8,
570  0x11C00, 0x11C08,
571  0x11C0A, 0x11C36,
572  0x11C38, 0x11C3E,
573  0x11C40, 0x11C40,
574  0x11C72, 0x11C8F,
575  0x11C92, 0x11CA7,
576  0x11CA9, 0x11CB6,
577  0x11D00, 0x11D06,
578  0x11D08, 0x11D09,
579  0x11D0B, 0x11D36,
580  0x11D3A, 0x11D3A,
581  0x11D3C, 0x11D3D,
582  0x11D3F, 0x11D41,
583  0x11D43, 0x11D43,
584  0x11D46, 0x11D47,
585  0x11D60, 0x11D65,
586  0x11D67, 0x11D68,
587  0x11D6A, 0x11D8E,
588  0x11D90, 0x11D91,
589  0x11D93, 0x11D96,
590  0x11D98, 0x11D98,
591  0x11EE0, 0x11EF6,
592  0x11F00, 0x11F10,
593  0x11F12, 0x11F3A,
594  0x11F3E, 0x11F40,
595  0x11FB0, 0x11FB0,
596  0x12000, 0x12399,
597  0x12400, 0x1246E,
598  0x12480, 0x12543,
599  0x12F90, 0x12FF0,
600  0x13000, 0x1342F,
601  0x13441, 0x13446,
602  0x14400, 0x14646,
603  0x16800, 0x16A38,
604  0x16A40, 0x16A5E,
605  0x16A70, 0x16ABE,
606  0x16AD0, 0x16AED,
607  0x16B00, 0x16B2F,
608  0x16B40, 0x16B43,
609  0x16B63, 0x16B77,
610  0x16B7D, 0x16B8F,
611  0x16E40, 0x16E7F,
612  0x16F00, 0x16F4A,
613  0x16F4F, 0x16F87,
614  0x16F8F, 0x16F9F,
615  0x16FE0, 0x16FE1,
616  0x16FE3, 0x16FE3,
617  0x16FF0, 0x16FF1,
618  0x17000, 0x187F7,
619  0x18800, 0x18CD5,
620  0x18D00, 0x18D08,
621  0x1AFF0, 0x1AFF3,
622  0x1AFF5, 0x1AFFB,
623  0x1AFFD, 0x1AFFE,
624  0x1B000, 0x1B122,
625  0x1B132, 0x1B132,
626  0x1B150, 0x1B152,
627  0x1B155, 0x1B155,
628  0x1B164, 0x1B167,
629  0x1B170, 0x1B2FB,
630  0x1BC00, 0x1BC6A,
631  0x1BC70, 0x1BC7C,
632  0x1BC80, 0x1BC88,
633  0x1BC90, 0x1BC99,
634  0x1BC9E, 0x1BC9E,
635  0x1D400, 0x1D454,
636  0x1D456, 0x1D49C,
637  0x1D49E, 0x1D49F,
638  0x1D4A2, 0x1D4A2,
639  0x1D4A5, 0x1D4A6,
640  0x1D4A9, 0x1D4AC,
641  0x1D4AE, 0x1D4B9,
642  0x1D4BB, 0x1D4BB,
643  0x1D4BD, 0x1D4C3,
644  0x1D4C5, 0x1D505,
645  0x1D507, 0x1D50A,
646  0x1D50D, 0x1D514,
647  0x1D516, 0x1D51C,
648  0x1D51E, 0x1D539,
649  0x1D53B, 0x1D53E,
650  0x1D540, 0x1D544,
651  0x1D546, 0x1D546,
652  0x1D54A, 0x1D550,
653  0x1D552, 0x1D6A5,
654  0x1D6A8, 0x1D6C0,
655  0x1D6C2, 0x1D6DA,
656  0x1D6DC, 0x1D6FA,
657  0x1D6FC, 0x1D714,
658  0x1D716, 0x1D734,
659  0x1D736, 0x1D74E,
660  0x1D750, 0x1D76E,
661  0x1D770, 0x1D788,
662  0x1D78A, 0x1D7A8,
663  0x1D7AA, 0x1D7C2,
664  0x1D7C4, 0x1D7CB,
665  0x1DF00, 0x1DF1E,
666  0x1DF25, 0x1DF2A,
667  0x1E000, 0x1E006,
668  0x1E008, 0x1E018,
669  0x1E01B, 0x1E021,
670  0x1E023, 0x1E024,
671  0x1E026, 0x1E02A,
672  0x1E030, 0x1E06D,
673  0x1E08F, 0x1E08F,
674  0x1E100, 0x1E12C,
675  0x1E137, 0x1E13D,
676  0x1E14E, 0x1E14E,
677  0x1E290, 0x1E2AD,
678  0x1E2C0, 0x1E2EB,
679  0x1E4D0, 0x1E4EB,
680  0x1E7E0, 0x1E7E6,
681  0x1E7E8, 0x1E7EB,
682  0x1E7ED, 0x1E7EE,
683  0x1E7F0, 0x1E7FE,
684  0x1E800, 0x1E8C4,
685  0x1E900, 0x1E943,
686  0x1E947, 0x1E947,
687  0x1E94B, 0x1E94B,
688  0x1EE00, 0x1EE03,
689  0x1EE05, 0x1EE1F,
690  0x1EE21, 0x1EE22,
691  0x1EE24, 0x1EE24,
692  0x1EE27, 0x1EE27,
693  0x1EE29, 0x1EE32,
694  0x1EE34, 0x1EE37,
695  0x1EE39, 0x1EE39,
696  0x1EE3B, 0x1EE3B,
697  0x1EE42, 0x1EE42,
698  0x1EE47, 0x1EE47,
699  0x1EE49, 0x1EE49,
700  0x1EE4B, 0x1EE4B,
701  0x1EE4D, 0x1EE4F,
702  0x1EE51, 0x1EE52,
703  0x1EE54, 0x1EE54,
704  0x1EE57, 0x1EE57,
705  0x1EE59, 0x1EE59,
706  0x1EE5B, 0x1EE5B,
707  0x1EE5D, 0x1EE5D,
708  0x1EE5F, 0x1EE5F,
709  0x1EE61, 0x1EE62,
710  0x1EE64, 0x1EE64,
711  0x1EE67, 0x1EE6A,
712  0x1EE6C, 0x1EE72,
713  0x1EE74, 0x1EE77,
714  0x1EE79, 0x1EE7C,
715  0x1EE7E, 0x1EE7E,
716  0x1EE80, 0x1EE89,
717  0x1EE8B, 0x1EE9B,
718  0x1EEA1, 0x1EEA3,
719  0x1EEA5, 0x1EEA9,
720  0x1EEAB, 0x1EEBB,
721  0x1F130, 0x1F149,
722  0x1F150, 0x1F169,
723  0x1F170, 0x1F189,
724  0x20000, 0x2A6DF,
725  0x2A700, 0x2B739,
726  0x2B740, 0x2B81D,
727  0x2B820, 0x2CEA1,
728  0x2CEB0, 0x2EBE0,
729  0x2F800, 0x2FA1D,
730  0x30000, 0x3134A,
731  0x31350, 0x323AF,
732 };
733 
734 #define UNICODE_ALNUM_CODEPOINTS_LENGTH 1528
735 static const pm_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_LENGTH] = {
736  0x100, 0x2C1,
737  0x2C6, 0x2D1,
738  0x2E0, 0x2E4,
739  0x2EC, 0x2EC,
740  0x2EE, 0x2EE,
741  0x345, 0x345,
742  0x370, 0x374,
743  0x376, 0x377,
744  0x37A, 0x37D,
745  0x37F, 0x37F,
746  0x386, 0x386,
747  0x388, 0x38A,
748  0x38C, 0x38C,
749  0x38E, 0x3A1,
750  0x3A3, 0x3F5,
751  0x3F7, 0x481,
752  0x48A, 0x52F,
753  0x531, 0x556,
754  0x559, 0x559,
755  0x560, 0x588,
756  0x5B0, 0x5BD,
757  0x5BF, 0x5BF,
758  0x5C1, 0x5C2,
759  0x5C4, 0x5C5,
760  0x5C7, 0x5C7,
761  0x5D0, 0x5EA,
762  0x5EF, 0x5F2,
763  0x610, 0x61A,
764  0x620, 0x657,
765  0x659, 0x669,
766  0x66E, 0x6D3,
767  0x6D5, 0x6DC,
768  0x6E1, 0x6E8,
769  0x6ED, 0x6FC,
770  0x6FF, 0x6FF,
771  0x710, 0x73F,
772  0x74D, 0x7B1,
773  0x7C0, 0x7EA,
774  0x7F4, 0x7F5,
775  0x7FA, 0x7FA,
776  0x800, 0x817,
777  0x81A, 0x82C,
778  0x840, 0x858,
779  0x860, 0x86A,
780  0x870, 0x887,
781  0x889, 0x88E,
782  0x8A0, 0x8C9,
783  0x8D4, 0x8DF,
784  0x8E3, 0x8E9,
785  0x8F0, 0x93B,
786  0x93D, 0x94C,
787  0x94E, 0x950,
788  0x955, 0x963,
789  0x966, 0x96F,
790  0x971, 0x983,
791  0x985, 0x98C,
792  0x98F, 0x990,
793  0x993, 0x9A8,
794  0x9AA, 0x9B0,
795  0x9B2, 0x9B2,
796  0x9B6, 0x9B9,
797  0x9BD, 0x9C4,
798  0x9C7, 0x9C8,
799  0x9CB, 0x9CC,
800  0x9CE, 0x9CE,
801  0x9D7, 0x9D7,
802  0x9DC, 0x9DD,
803  0x9DF, 0x9E3,
804  0x9E6, 0x9F1,
805  0x9FC, 0x9FC,
806  0xA01, 0xA03,
807  0xA05, 0xA0A,
808  0xA0F, 0xA10,
809  0xA13, 0xA28,
810  0xA2A, 0xA30,
811  0xA32, 0xA33,
812  0xA35, 0xA36,
813  0xA38, 0xA39,
814  0xA3E, 0xA42,
815  0xA47, 0xA48,
816  0xA4B, 0xA4C,
817  0xA51, 0xA51,
818  0xA59, 0xA5C,
819  0xA5E, 0xA5E,
820  0xA66, 0xA75,
821  0xA81, 0xA83,
822  0xA85, 0xA8D,
823  0xA8F, 0xA91,
824  0xA93, 0xAA8,
825  0xAAA, 0xAB0,
826  0xAB2, 0xAB3,
827  0xAB5, 0xAB9,
828  0xABD, 0xAC5,
829  0xAC7, 0xAC9,
830  0xACB, 0xACC,
831  0xAD0, 0xAD0,
832  0xAE0, 0xAE3,
833  0xAE6, 0xAEF,
834  0xAF9, 0xAFC,
835  0xB01, 0xB03,
836  0xB05, 0xB0C,
837  0xB0F, 0xB10,
838  0xB13, 0xB28,
839  0xB2A, 0xB30,
840  0xB32, 0xB33,
841  0xB35, 0xB39,
842  0xB3D, 0xB44,
843  0xB47, 0xB48,
844  0xB4B, 0xB4C,
845  0xB56, 0xB57,
846  0xB5C, 0xB5D,
847  0xB5F, 0xB63,
848  0xB66, 0xB6F,
849  0xB71, 0xB71,
850  0xB82, 0xB83,
851  0xB85, 0xB8A,
852  0xB8E, 0xB90,
853  0xB92, 0xB95,
854  0xB99, 0xB9A,
855  0xB9C, 0xB9C,
856  0xB9E, 0xB9F,
857  0xBA3, 0xBA4,
858  0xBA8, 0xBAA,
859  0xBAE, 0xBB9,
860  0xBBE, 0xBC2,
861  0xBC6, 0xBC8,
862  0xBCA, 0xBCC,
863  0xBD0, 0xBD0,
864  0xBD7, 0xBD7,
865  0xBE6, 0xBEF,
866  0xC00, 0xC0C,
867  0xC0E, 0xC10,
868  0xC12, 0xC28,
869  0xC2A, 0xC39,
870  0xC3D, 0xC44,
871  0xC46, 0xC48,
872  0xC4A, 0xC4C,
873  0xC55, 0xC56,
874  0xC58, 0xC5A,
875  0xC5D, 0xC5D,
876  0xC60, 0xC63,
877  0xC66, 0xC6F,
878  0xC80, 0xC83,
879  0xC85, 0xC8C,
880  0xC8E, 0xC90,
881  0xC92, 0xCA8,
882  0xCAA, 0xCB3,
883  0xCB5, 0xCB9,
884  0xCBD, 0xCC4,
885  0xCC6, 0xCC8,
886  0xCCA, 0xCCC,
887  0xCD5, 0xCD6,
888  0xCDD, 0xCDE,
889  0xCE0, 0xCE3,
890  0xCE6, 0xCEF,
891  0xCF1, 0xCF3,
892  0xD00, 0xD0C,
893  0xD0E, 0xD10,
894  0xD12, 0xD3A,
895  0xD3D, 0xD44,
896  0xD46, 0xD48,
897  0xD4A, 0xD4C,
898  0xD4E, 0xD4E,
899  0xD54, 0xD57,
900  0xD5F, 0xD63,
901  0xD66, 0xD6F,
902  0xD7A, 0xD7F,
903  0xD81, 0xD83,
904  0xD85, 0xD96,
905  0xD9A, 0xDB1,
906  0xDB3, 0xDBB,
907  0xDBD, 0xDBD,
908  0xDC0, 0xDC6,
909  0xDCF, 0xDD4,
910  0xDD6, 0xDD6,
911  0xDD8, 0xDDF,
912  0xDE6, 0xDEF,
913  0xDF2, 0xDF3,
914  0xE01, 0xE3A,
915  0xE40, 0xE46,
916  0xE4D, 0xE4D,
917  0xE50, 0xE59,
918  0xE81, 0xE82,
919  0xE84, 0xE84,
920  0xE86, 0xE8A,
921  0xE8C, 0xEA3,
922  0xEA5, 0xEA5,
923  0xEA7, 0xEB9,
924  0xEBB, 0xEBD,
925  0xEC0, 0xEC4,
926  0xEC6, 0xEC6,
927  0xECD, 0xECD,
928  0xED0, 0xED9,
929  0xEDC, 0xEDF,
930  0xF00, 0xF00,
931  0xF20, 0xF29,
932  0xF40, 0xF47,
933  0xF49, 0xF6C,
934  0xF71, 0xF83,
935  0xF88, 0xF97,
936  0xF99, 0xFBC,
937  0x1000, 0x1036,
938  0x1038, 0x1038,
939  0x103B, 0x1049,
940  0x1050, 0x109D,
941  0x10A0, 0x10C5,
942  0x10C7, 0x10C7,
943  0x10CD, 0x10CD,
944  0x10D0, 0x10FA,
945  0x10FC, 0x1248,
946  0x124A, 0x124D,
947  0x1250, 0x1256,
948  0x1258, 0x1258,
949  0x125A, 0x125D,
950  0x1260, 0x1288,
951  0x128A, 0x128D,
952  0x1290, 0x12B0,
953  0x12B2, 0x12B5,
954  0x12B8, 0x12BE,
955  0x12C0, 0x12C0,
956  0x12C2, 0x12C5,
957  0x12C8, 0x12D6,
958  0x12D8, 0x1310,
959  0x1312, 0x1315,
960  0x1318, 0x135A,
961  0x1380, 0x138F,
962  0x13A0, 0x13F5,
963  0x13F8, 0x13FD,
964  0x1401, 0x166C,
965  0x166F, 0x167F,
966  0x1681, 0x169A,
967  0x16A0, 0x16EA,
968  0x16EE, 0x16F8,
969  0x1700, 0x1713,
970  0x171F, 0x1733,
971  0x1740, 0x1753,
972  0x1760, 0x176C,
973  0x176E, 0x1770,
974  0x1772, 0x1773,
975  0x1780, 0x17B3,
976  0x17B6, 0x17C8,
977  0x17D7, 0x17D7,
978  0x17DC, 0x17DC,
979  0x17E0, 0x17E9,
980  0x1810, 0x1819,
981  0x1820, 0x1878,
982  0x1880, 0x18AA,
983  0x18B0, 0x18F5,
984  0x1900, 0x191E,
985  0x1920, 0x192B,
986  0x1930, 0x1938,
987  0x1946, 0x196D,
988  0x1970, 0x1974,
989  0x1980, 0x19AB,
990  0x19B0, 0x19C9,
991  0x19D0, 0x19D9,
992  0x1A00, 0x1A1B,
993  0x1A20, 0x1A5E,
994  0x1A61, 0x1A74,
995  0x1A80, 0x1A89,
996  0x1A90, 0x1A99,
997  0x1AA7, 0x1AA7,
998  0x1ABF, 0x1AC0,
999  0x1ACC, 0x1ACE,
1000  0x1B00, 0x1B33,
1001  0x1B35, 0x1B43,
1002  0x1B45, 0x1B4C,
1003  0x1B50, 0x1B59,
1004  0x1B80, 0x1BA9,
1005  0x1BAC, 0x1BE5,
1006  0x1BE7, 0x1BF1,
1007  0x1C00, 0x1C36,
1008  0x1C40, 0x1C49,
1009  0x1C4D, 0x1C7D,
1010  0x1C80, 0x1C88,
1011  0x1C90, 0x1CBA,
1012  0x1CBD, 0x1CBF,
1013  0x1CE9, 0x1CEC,
1014  0x1CEE, 0x1CF3,
1015  0x1CF5, 0x1CF6,
1016  0x1CFA, 0x1CFA,
1017  0x1D00, 0x1DBF,
1018  0x1DE7, 0x1DF4,
1019  0x1E00, 0x1F15,
1020  0x1F18, 0x1F1D,
1021  0x1F20, 0x1F45,
1022  0x1F48, 0x1F4D,
1023  0x1F50, 0x1F57,
1024  0x1F59, 0x1F59,
1025  0x1F5B, 0x1F5B,
1026  0x1F5D, 0x1F5D,
1027  0x1F5F, 0x1F7D,
1028  0x1F80, 0x1FB4,
1029  0x1FB6, 0x1FBC,
1030  0x1FBE, 0x1FBE,
1031  0x1FC2, 0x1FC4,
1032  0x1FC6, 0x1FCC,
1033  0x1FD0, 0x1FD3,
1034  0x1FD6, 0x1FDB,
1035  0x1FE0, 0x1FEC,
1036  0x1FF2, 0x1FF4,
1037  0x1FF6, 0x1FFC,
1038  0x2071, 0x2071,
1039  0x207F, 0x207F,
1040  0x2090, 0x209C,
1041  0x2102, 0x2102,
1042  0x2107, 0x2107,
1043  0x210A, 0x2113,
1044  0x2115, 0x2115,
1045  0x2119, 0x211D,
1046  0x2124, 0x2124,
1047  0x2126, 0x2126,
1048  0x2128, 0x2128,
1049  0x212A, 0x212D,
1050  0x212F, 0x2139,
1051  0x213C, 0x213F,
1052  0x2145, 0x2149,
1053  0x214E, 0x214E,
1054  0x2160, 0x2188,
1055  0x24B6, 0x24E9,
1056  0x2C00, 0x2CE4,
1057  0x2CEB, 0x2CEE,
1058  0x2CF2, 0x2CF3,
1059  0x2D00, 0x2D25,
1060  0x2D27, 0x2D27,
1061  0x2D2D, 0x2D2D,
1062  0x2D30, 0x2D67,
1063  0x2D6F, 0x2D6F,
1064  0x2D80, 0x2D96,
1065  0x2DA0, 0x2DA6,
1066  0x2DA8, 0x2DAE,
1067  0x2DB0, 0x2DB6,
1068  0x2DB8, 0x2DBE,
1069  0x2DC0, 0x2DC6,
1070  0x2DC8, 0x2DCE,
1071  0x2DD0, 0x2DD6,
1072  0x2DD8, 0x2DDE,
1073  0x2DE0, 0x2DFF,
1074  0x2E2F, 0x2E2F,
1075  0x3005, 0x3007,
1076  0x3021, 0x3029,
1077  0x3031, 0x3035,
1078  0x3038, 0x303C,
1079  0x3041, 0x3096,
1080  0x309D, 0x309F,
1081  0x30A1, 0x30FA,
1082  0x30FC, 0x30FF,
1083  0x3105, 0x312F,
1084  0x3131, 0x318E,
1085  0x31A0, 0x31BF,
1086  0x31F0, 0x31FF,
1087  0x3400, 0x4DBF,
1088  0x4E00, 0xA48C,
1089  0xA4D0, 0xA4FD,
1090  0xA500, 0xA60C,
1091  0xA610, 0xA62B,
1092  0xA640, 0xA66E,
1093  0xA674, 0xA67B,
1094  0xA67F, 0xA6EF,
1095  0xA717, 0xA71F,
1096  0xA722, 0xA788,
1097  0xA78B, 0xA7CA,
1098  0xA7D0, 0xA7D1,
1099  0xA7D3, 0xA7D3,
1100  0xA7D5, 0xA7D9,
1101  0xA7F2, 0xA805,
1102  0xA807, 0xA827,
1103  0xA840, 0xA873,
1104  0xA880, 0xA8C3,
1105  0xA8C5, 0xA8C5,
1106  0xA8D0, 0xA8D9,
1107  0xA8F2, 0xA8F7,
1108  0xA8FB, 0xA8FB,
1109  0xA8FD, 0xA92A,
1110  0xA930, 0xA952,
1111  0xA960, 0xA97C,
1112  0xA980, 0xA9B2,
1113  0xA9B4, 0xA9BF,
1114  0xA9CF, 0xA9D9,
1115  0xA9E0, 0xA9FE,
1116  0xAA00, 0xAA36,
1117  0xAA40, 0xAA4D,
1118  0xAA50, 0xAA59,
1119  0xAA60, 0xAA76,
1120  0xAA7A, 0xAABE,
1121  0xAAC0, 0xAAC0,
1122  0xAAC2, 0xAAC2,
1123  0xAADB, 0xAADD,
1124  0xAAE0, 0xAAEF,
1125  0xAAF2, 0xAAF5,
1126  0xAB01, 0xAB06,
1127  0xAB09, 0xAB0E,
1128  0xAB11, 0xAB16,
1129  0xAB20, 0xAB26,
1130  0xAB28, 0xAB2E,
1131  0xAB30, 0xAB5A,
1132  0xAB5C, 0xAB69,
1133  0xAB70, 0xABEA,
1134  0xABF0, 0xABF9,
1135  0xAC00, 0xD7A3,
1136  0xD7B0, 0xD7C6,
1137  0xD7CB, 0xD7FB,
1138  0xF900, 0xFA6D,
1139  0xFA70, 0xFAD9,
1140  0xFB00, 0xFB06,
1141  0xFB13, 0xFB17,
1142  0xFB1D, 0xFB28,
1143  0xFB2A, 0xFB36,
1144  0xFB38, 0xFB3C,
1145  0xFB3E, 0xFB3E,
1146  0xFB40, 0xFB41,
1147  0xFB43, 0xFB44,
1148  0xFB46, 0xFBB1,
1149  0xFBD3, 0xFD3D,
1150  0xFD50, 0xFD8F,
1151  0xFD92, 0xFDC7,
1152  0xFDF0, 0xFDFB,
1153  0xFE70, 0xFE74,
1154  0xFE76, 0xFEFC,
1155  0xFF10, 0xFF19,
1156  0xFF21, 0xFF3A,
1157  0xFF41, 0xFF5A,
1158  0xFF66, 0xFFBE,
1159  0xFFC2, 0xFFC7,
1160  0xFFCA, 0xFFCF,
1161  0xFFD2, 0xFFD7,
1162  0xFFDA, 0xFFDC,
1163  0x10000, 0x1000B,
1164  0x1000D, 0x10026,
1165  0x10028, 0x1003A,
1166  0x1003C, 0x1003D,
1167  0x1003F, 0x1004D,
1168  0x10050, 0x1005D,
1169  0x10080, 0x100FA,
1170  0x10140, 0x10174,
1171  0x10280, 0x1029C,
1172  0x102A0, 0x102D0,
1173  0x10300, 0x1031F,
1174  0x1032D, 0x1034A,
1175  0x10350, 0x1037A,
1176  0x10380, 0x1039D,
1177  0x103A0, 0x103C3,
1178  0x103C8, 0x103CF,
1179  0x103D1, 0x103D5,
1180  0x10400, 0x1049D,
1181  0x104A0, 0x104A9,
1182  0x104B0, 0x104D3,
1183  0x104D8, 0x104FB,
1184  0x10500, 0x10527,
1185  0x10530, 0x10563,
1186  0x10570, 0x1057A,
1187  0x1057C, 0x1058A,
1188  0x1058C, 0x10592,
1189  0x10594, 0x10595,
1190  0x10597, 0x105A1,
1191  0x105A3, 0x105B1,
1192  0x105B3, 0x105B9,
1193  0x105BB, 0x105BC,
1194  0x10600, 0x10736,
1195  0x10740, 0x10755,
1196  0x10760, 0x10767,
1197  0x10780, 0x10785,
1198  0x10787, 0x107B0,
1199  0x107B2, 0x107BA,
1200  0x10800, 0x10805,
1201  0x10808, 0x10808,
1202  0x1080A, 0x10835,
1203  0x10837, 0x10838,
1204  0x1083C, 0x1083C,
1205  0x1083F, 0x10855,
1206  0x10860, 0x10876,
1207  0x10880, 0x1089E,
1208  0x108E0, 0x108F2,
1209  0x108F4, 0x108F5,
1210  0x10900, 0x10915,
1211  0x10920, 0x10939,
1212  0x10980, 0x109B7,
1213  0x109BE, 0x109BF,
1214  0x10A00, 0x10A03,
1215  0x10A05, 0x10A06,
1216  0x10A0C, 0x10A13,
1217  0x10A15, 0x10A17,
1218  0x10A19, 0x10A35,
1219  0x10A60, 0x10A7C,
1220  0x10A80, 0x10A9C,
1221  0x10AC0, 0x10AC7,
1222  0x10AC9, 0x10AE4,
1223  0x10B00, 0x10B35,
1224  0x10B40, 0x10B55,
1225  0x10B60, 0x10B72,
1226  0x10B80, 0x10B91,
1227  0x10C00, 0x10C48,
1228  0x10C80, 0x10CB2,
1229  0x10CC0, 0x10CF2,
1230  0x10D00, 0x10D27,
1231  0x10D30, 0x10D39,
1232  0x10E80, 0x10EA9,
1233  0x10EAB, 0x10EAC,
1234  0x10EB0, 0x10EB1,
1235  0x10F00, 0x10F1C,
1236  0x10F27, 0x10F27,
1237  0x10F30, 0x10F45,
1238  0x10F70, 0x10F81,
1239  0x10FB0, 0x10FC4,
1240  0x10FE0, 0x10FF6,
1241  0x11000, 0x11045,
1242  0x11066, 0x1106F,
1243  0x11071, 0x11075,
1244  0x11080, 0x110B8,
1245  0x110C2, 0x110C2,
1246  0x110D0, 0x110E8,
1247  0x110F0, 0x110F9,
1248  0x11100, 0x11132,
1249  0x11136, 0x1113F,
1250  0x11144, 0x11147,
1251  0x11150, 0x11172,
1252  0x11176, 0x11176,
1253  0x11180, 0x111BF,
1254  0x111C1, 0x111C4,
1255  0x111CE, 0x111DA,
1256  0x111DC, 0x111DC,
1257  0x11200, 0x11211,
1258  0x11213, 0x11234,
1259  0x11237, 0x11237,
1260  0x1123E, 0x11241,
1261  0x11280, 0x11286,
1262  0x11288, 0x11288,
1263  0x1128A, 0x1128D,
1264  0x1128F, 0x1129D,
1265  0x1129F, 0x112A8,
1266  0x112B0, 0x112E8,
1267  0x112F0, 0x112F9,
1268  0x11300, 0x11303,
1269  0x11305, 0x1130C,
1270  0x1130F, 0x11310,
1271  0x11313, 0x11328,
1272  0x1132A, 0x11330,
1273  0x11332, 0x11333,
1274  0x11335, 0x11339,
1275  0x1133D, 0x11344,
1276  0x11347, 0x11348,
1277  0x1134B, 0x1134C,
1278  0x11350, 0x11350,
1279  0x11357, 0x11357,
1280  0x1135D, 0x11363,
1281  0x11400, 0x11441,
1282  0x11443, 0x11445,
1283  0x11447, 0x1144A,
1284  0x11450, 0x11459,
1285  0x1145F, 0x11461,
1286  0x11480, 0x114C1,
1287  0x114C4, 0x114C5,
1288  0x114C7, 0x114C7,
1289  0x114D0, 0x114D9,
1290  0x11580, 0x115B5,
1291  0x115B8, 0x115BE,
1292  0x115D8, 0x115DD,
1293  0x11600, 0x1163E,
1294  0x11640, 0x11640,
1295  0x11644, 0x11644,
1296  0x11650, 0x11659,
1297  0x11680, 0x116B5,
1298  0x116B8, 0x116B8,
1299  0x116C0, 0x116C9,
1300  0x11700, 0x1171A,
1301  0x1171D, 0x1172A,
1302  0x11730, 0x11739,
1303  0x11740, 0x11746,
1304  0x11800, 0x11838,
1305  0x118A0, 0x118E9,
1306  0x118FF, 0x11906,
1307  0x11909, 0x11909,
1308  0x1190C, 0x11913,
1309  0x11915, 0x11916,
1310  0x11918, 0x11935,
1311  0x11937, 0x11938,
1312  0x1193B, 0x1193C,
1313  0x1193F, 0x11942,
1314  0x11950, 0x11959,
1315  0x119A0, 0x119A7,
1316  0x119AA, 0x119D7,
1317  0x119DA, 0x119DF,
1318  0x119E1, 0x119E1,
1319  0x119E3, 0x119E4,
1320  0x11A00, 0x11A32,
1321  0x11A35, 0x11A3E,
1322  0x11A50, 0x11A97,
1323  0x11A9D, 0x11A9D,
1324  0x11AB0, 0x11AF8,
1325  0x11C00, 0x11C08,
1326  0x11C0A, 0x11C36,
1327  0x11C38, 0x11C3E,
1328  0x11C40, 0x11C40,
1329  0x11C50, 0x11C59,
1330  0x11C72, 0x11C8F,
1331  0x11C92, 0x11CA7,
1332  0x11CA9, 0x11CB6,
1333  0x11D00, 0x11D06,
1334  0x11D08, 0x11D09,
1335  0x11D0B, 0x11D36,
1336  0x11D3A, 0x11D3A,
1337  0x11D3C, 0x11D3D,
1338  0x11D3F, 0x11D41,
1339  0x11D43, 0x11D43,
1340  0x11D46, 0x11D47,
1341  0x11D50, 0x11D59,
1342  0x11D60, 0x11D65,
1343  0x11D67, 0x11D68,
1344  0x11D6A, 0x11D8E,
1345  0x11D90, 0x11D91,
1346  0x11D93, 0x11D96,
1347  0x11D98, 0x11D98,
1348  0x11DA0, 0x11DA9,
1349  0x11EE0, 0x11EF6,
1350  0x11F00, 0x11F10,
1351  0x11F12, 0x11F3A,
1352  0x11F3E, 0x11F40,
1353  0x11F50, 0x11F59,
1354  0x11FB0, 0x11FB0,
1355  0x12000, 0x12399,
1356  0x12400, 0x1246E,
1357  0x12480, 0x12543,
1358  0x12F90, 0x12FF0,
1359  0x13000, 0x1342F,
1360  0x13441, 0x13446,
1361  0x14400, 0x14646,
1362  0x16800, 0x16A38,
1363  0x16A40, 0x16A5E,
1364  0x16A60, 0x16A69,
1365  0x16A70, 0x16ABE,
1366  0x16AC0, 0x16AC9,
1367  0x16AD0, 0x16AED,
1368  0x16B00, 0x16B2F,
1369  0x16B40, 0x16B43,
1370  0x16B50, 0x16B59,
1371  0x16B63, 0x16B77,
1372  0x16B7D, 0x16B8F,
1373  0x16E40, 0x16E7F,
1374  0x16F00, 0x16F4A,
1375  0x16F4F, 0x16F87,
1376  0x16F8F, 0x16F9F,
1377  0x16FE0, 0x16FE1,
1378  0x16FE3, 0x16FE3,
1379  0x16FF0, 0x16FF1,
1380  0x17000, 0x187F7,
1381  0x18800, 0x18CD5,
1382  0x18D00, 0x18D08,
1383  0x1AFF0, 0x1AFF3,
1384  0x1AFF5, 0x1AFFB,
1385  0x1AFFD, 0x1AFFE,
1386  0x1B000, 0x1B122,
1387  0x1B132, 0x1B132,
1388  0x1B150, 0x1B152,
1389  0x1B155, 0x1B155,
1390  0x1B164, 0x1B167,
1391  0x1B170, 0x1B2FB,
1392  0x1BC00, 0x1BC6A,
1393  0x1BC70, 0x1BC7C,
1394  0x1BC80, 0x1BC88,
1395  0x1BC90, 0x1BC99,
1396  0x1BC9E, 0x1BC9E,
1397  0x1D400, 0x1D454,
1398  0x1D456, 0x1D49C,
1399  0x1D49E, 0x1D49F,
1400  0x1D4A2, 0x1D4A2,
1401  0x1D4A5, 0x1D4A6,
1402  0x1D4A9, 0x1D4AC,
1403  0x1D4AE, 0x1D4B9,
1404  0x1D4BB, 0x1D4BB,
1405  0x1D4BD, 0x1D4C3,
1406  0x1D4C5, 0x1D505,
1407  0x1D507, 0x1D50A,
1408  0x1D50D, 0x1D514,
1409  0x1D516, 0x1D51C,
1410  0x1D51E, 0x1D539,
1411  0x1D53B, 0x1D53E,
1412  0x1D540, 0x1D544,
1413  0x1D546, 0x1D546,
1414  0x1D54A, 0x1D550,
1415  0x1D552, 0x1D6A5,
1416  0x1D6A8, 0x1D6C0,
1417  0x1D6C2, 0x1D6DA,
1418  0x1D6DC, 0x1D6FA,
1419  0x1D6FC, 0x1D714,
1420  0x1D716, 0x1D734,
1421  0x1D736, 0x1D74E,
1422  0x1D750, 0x1D76E,
1423  0x1D770, 0x1D788,
1424  0x1D78A, 0x1D7A8,
1425  0x1D7AA, 0x1D7C2,
1426  0x1D7C4, 0x1D7CB,
1427  0x1D7CE, 0x1D7FF,
1428  0x1DF00, 0x1DF1E,
1429  0x1DF25, 0x1DF2A,
1430  0x1E000, 0x1E006,
1431  0x1E008, 0x1E018,
1432  0x1E01B, 0x1E021,
1433  0x1E023, 0x1E024,
1434  0x1E026, 0x1E02A,
1435  0x1E030, 0x1E06D,
1436  0x1E08F, 0x1E08F,
1437  0x1E100, 0x1E12C,
1438  0x1E137, 0x1E13D,
1439  0x1E140, 0x1E149,
1440  0x1E14E, 0x1E14E,
1441  0x1E290, 0x1E2AD,
1442  0x1E2C0, 0x1E2EB,
1443  0x1E2F0, 0x1E2F9,
1444  0x1E4D0, 0x1E4EB,
1445  0x1E4F0, 0x1E4F9,
1446  0x1E7E0, 0x1E7E6,
1447  0x1E7E8, 0x1E7EB,
1448  0x1E7ED, 0x1E7EE,
1449  0x1E7F0, 0x1E7FE,
1450  0x1E800, 0x1E8C4,
1451  0x1E900, 0x1E943,
1452  0x1E947, 0x1E947,
1453  0x1E94B, 0x1E94B,
1454  0x1E950, 0x1E959,
1455  0x1EE00, 0x1EE03,
1456  0x1EE05, 0x1EE1F,
1457  0x1EE21, 0x1EE22,
1458  0x1EE24, 0x1EE24,
1459  0x1EE27, 0x1EE27,
1460  0x1EE29, 0x1EE32,
1461  0x1EE34, 0x1EE37,
1462  0x1EE39, 0x1EE39,
1463  0x1EE3B, 0x1EE3B,
1464  0x1EE42, 0x1EE42,
1465  0x1EE47, 0x1EE47,
1466  0x1EE49, 0x1EE49,
1467  0x1EE4B, 0x1EE4B,
1468  0x1EE4D, 0x1EE4F,
1469  0x1EE51, 0x1EE52,
1470  0x1EE54, 0x1EE54,
1471  0x1EE57, 0x1EE57,
1472  0x1EE59, 0x1EE59,
1473  0x1EE5B, 0x1EE5B,
1474  0x1EE5D, 0x1EE5D,
1475  0x1EE5F, 0x1EE5F,
1476  0x1EE61, 0x1EE62,
1477  0x1EE64, 0x1EE64,
1478  0x1EE67, 0x1EE6A,
1479  0x1EE6C, 0x1EE72,
1480  0x1EE74, 0x1EE77,
1481  0x1EE79, 0x1EE7C,
1482  0x1EE7E, 0x1EE7E,
1483  0x1EE80, 0x1EE89,
1484  0x1EE8B, 0x1EE9B,
1485  0x1EEA1, 0x1EEA3,
1486  0x1EEA5, 0x1EEA9,
1487  0x1EEAB, 0x1EEBB,
1488  0x1F130, 0x1F149,
1489  0x1F150, 0x1F169,
1490  0x1F170, 0x1F189,
1491  0x1FBF0, 0x1FBF9,
1492  0x20000, 0x2A6DF,
1493  0x2A700, 0x2B739,
1494  0x2B740, 0x2B81D,
1495  0x2B820, 0x2CEA1,
1496  0x2CEB0, 0x2EBE0,
1497  0x2F800, 0x2FA1D,
1498  0x30000, 0x3134A,
1499  0x31350, 0x323AF,
1500 };
1501 
1502 #define UNICODE_ISUPPER_CODEPOINTS_LENGTH 1302
1503 static const pm_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOINTS_LENGTH] = {
1504  0x100, 0x100,
1505  0x102, 0x102,
1506  0x104, 0x104,
1507  0x106, 0x106,
1508  0x108, 0x108,
1509  0x10A, 0x10A,
1510  0x10C, 0x10C,
1511  0x10E, 0x10E,
1512  0x110, 0x110,
1513  0x112, 0x112,
1514  0x114, 0x114,
1515  0x116, 0x116,
1516  0x118, 0x118,
1517  0x11A, 0x11A,
1518  0x11C, 0x11C,
1519  0x11E, 0x11E,
1520  0x120, 0x120,
1521  0x122, 0x122,
1522  0x124, 0x124,
1523  0x126, 0x126,
1524  0x128, 0x128,
1525  0x12A, 0x12A,
1526  0x12C, 0x12C,
1527  0x12E, 0x12E,
1528  0x130, 0x130,
1529  0x132, 0x132,
1530  0x134, 0x134,
1531  0x136, 0x136,
1532  0x139, 0x139,
1533  0x13B, 0x13B,
1534  0x13D, 0x13D,
1535  0x13F, 0x13F,
1536  0x141, 0x141,
1537  0x143, 0x143,
1538  0x145, 0x145,
1539  0x147, 0x147,
1540  0x14A, 0x14A,
1541  0x14C, 0x14C,
1542  0x14E, 0x14E,
1543  0x150, 0x150,
1544  0x152, 0x152,
1545  0x154, 0x154,
1546  0x156, 0x156,
1547  0x158, 0x158,
1548  0x15A, 0x15A,
1549  0x15C, 0x15C,
1550  0x15E, 0x15E,
1551  0x160, 0x160,
1552  0x162, 0x162,
1553  0x164, 0x164,
1554  0x166, 0x166,
1555  0x168, 0x168,
1556  0x16A, 0x16A,
1557  0x16C, 0x16C,
1558  0x16E, 0x16E,
1559  0x170, 0x170,
1560  0x172, 0x172,
1561  0x174, 0x174,
1562  0x176, 0x176,
1563  0x178, 0x179,
1564  0x17B, 0x17B,
1565  0x17D, 0x17D,
1566  0x181, 0x182,
1567  0x184, 0x184,
1568  0x186, 0x187,
1569  0x189, 0x18B,
1570  0x18E, 0x191,
1571  0x193, 0x194,
1572  0x196, 0x198,
1573  0x19C, 0x19D,
1574  0x19F, 0x1A0,
1575  0x1A2, 0x1A2,
1576  0x1A4, 0x1A4,
1577  0x1A6, 0x1A7,
1578  0x1A9, 0x1A9,
1579  0x1AC, 0x1AC,
1580  0x1AE, 0x1AF,
1581  0x1B1, 0x1B3,
1582  0x1B5, 0x1B5,
1583  0x1B7, 0x1B8,
1584  0x1BC, 0x1BC,
1585  0x1C4, 0x1C5,
1586  0x1C7, 0x1C8,
1587  0x1CA, 0x1CB,
1588  0x1CD, 0x1CD,
1589  0x1CF, 0x1CF,
1590  0x1D1, 0x1D1,
1591  0x1D3, 0x1D3,
1592  0x1D5, 0x1D5,
1593  0x1D7, 0x1D7,
1594  0x1D9, 0x1D9,
1595  0x1DB, 0x1DB,
1596  0x1DE, 0x1DE,
1597  0x1E0, 0x1E0,
1598  0x1E2, 0x1E2,
1599  0x1E4, 0x1E4,
1600  0x1E6, 0x1E6,
1601  0x1E8, 0x1E8,
1602  0x1EA, 0x1EA,
1603  0x1EC, 0x1EC,
1604  0x1EE, 0x1EE,
1605  0x1F1, 0x1F2,
1606  0x1F4, 0x1F4,
1607  0x1F6, 0x1F8,
1608  0x1FA, 0x1FA,
1609  0x1FC, 0x1FC,
1610  0x1FE, 0x1FE,
1611  0x200, 0x200,
1612  0x202, 0x202,
1613  0x204, 0x204,
1614  0x206, 0x206,
1615  0x208, 0x208,
1616  0x20A, 0x20A,
1617  0x20C, 0x20C,
1618  0x20E, 0x20E,
1619  0x210, 0x210,
1620  0x212, 0x212,
1621  0x214, 0x214,
1622  0x216, 0x216,
1623  0x218, 0x218,
1624  0x21A, 0x21A,
1625  0x21C, 0x21C,
1626  0x21E, 0x21E,
1627  0x220, 0x220,
1628  0x222, 0x222,
1629  0x224, 0x224,
1630  0x226, 0x226,
1631  0x228, 0x228,
1632  0x22A, 0x22A,
1633  0x22C, 0x22C,
1634  0x22E, 0x22E,
1635  0x230, 0x230,
1636  0x232, 0x232,
1637  0x23A, 0x23B,
1638  0x23D, 0x23E,
1639  0x241, 0x241,
1640  0x243, 0x246,
1641  0x248, 0x248,
1642  0x24A, 0x24A,
1643  0x24C, 0x24C,
1644  0x24E, 0x24E,
1645  0x370, 0x370,
1646  0x372, 0x372,
1647  0x376, 0x376,
1648  0x37F, 0x37F,
1649  0x386, 0x386,
1650  0x388, 0x38A,
1651  0x38C, 0x38C,
1652  0x38E, 0x38F,
1653  0x391, 0x3A1,
1654  0x3A3, 0x3AB,
1655  0x3CF, 0x3CF,
1656  0x3D2, 0x3D4,
1657  0x3D8, 0x3D8,
1658  0x3DA, 0x3DA,
1659  0x3DC, 0x3DC,
1660  0x3DE, 0x3DE,
1661  0x3E0, 0x3E0,
1662  0x3E2, 0x3E2,
1663  0x3E4, 0x3E4,
1664  0x3E6, 0x3E6,
1665  0x3E8, 0x3E8,
1666  0x3EA, 0x3EA,
1667  0x3EC, 0x3EC,
1668  0x3EE, 0x3EE,
1669  0x3F4, 0x3F4,
1670  0x3F7, 0x3F7,
1671  0x3F9, 0x3FA,
1672  0x3FD, 0x42F,
1673  0x460, 0x460,
1674  0x462, 0x462,
1675  0x464, 0x464,
1676  0x466, 0x466,
1677  0x468, 0x468,
1678  0x46A, 0x46A,
1679  0x46C, 0x46C,
1680  0x46E, 0x46E,
1681  0x470, 0x470,
1682  0x472, 0x472,
1683  0x474, 0x474,
1684  0x476, 0x476,
1685  0x478, 0x478,
1686  0x47A, 0x47A,
1687  0x47C, 0x47C,
1688  0x47E, 0x47E,
1689  0x480, 0x480,
1690  0x48A, 0x48A,
1691  0x48C, 0x48C,
1692  0x48E, 0x48E,
1693  0x490, 0x490,
1694  0x492, 0x492,
1695  0x494, 0x494,
1696  0x496, 0x496,
1697  0x498, 0x498,
1698  0x49A, 0x49A,
1699  0x49C, 0x49C,
1700  0x49E, 0x49E,
1701  0x4A0, 0x4A0,
1702  0x4A2, 0x4A2,
1703  0x4A4, 0x4A4,
1704  0x4A6, 0x4A6,
1705  0x4A8, 0x4A8,
1706  0x4AA, 0x4AA,
1707  0x4AC, 0x4AC,
1708  0x4AE, 0x4AE,
1709  0x4B0, 0x4B0,
1710  0x4B2, 0x4B2,
1711  0x4B4, 0x4B4,
1712  0x4B6, 0x4B6,
1713  0x4B8, 0x4B8,
1714  0x4BA, 0x4BA,
1715  0x4BC, 0x4BC,
1716  0x4BE, 0x4BE,
1717  0x4C0, 0x4C1,
1718  0x4C3, 0x4C3,
1719  0x4C5, 0x4C5,
1720  0x4C7, 0x4C7,
1721  0x4C9, 0x4C9,
1722  0x4CB, 0x4CB,
1723  0x4CD, 0x4CD,
1724  0x4D0, 0x4D0,
1725  0x4D2, 0x4D2,
1726  0x4D4, 0x4D4,
1727  0x4D6, 0x4D6,
1728  0x4D8, 0x4D8,
1729  0x4DA, 0x4DA,
1730  0x4DC, 0x4DC,
1731  0x4DE, 0x4DE,
1732  0x4E0, 0x4E0,
1733  0x4E2, 0x4E2,
1734  0x4E4, 0x4E4,
1735  0x4E6, 0x4E6,
1736  0x4E8, 0x4E8,
1737  0x4EA, 0x4EA,
1738  0x4EC, 0x4EC,
1739  0x4EE, 0x4EE,
1740  0x4F0, 0x4F0,
1741  0x4F2, 0x4F2,
1742  0x4F4, 0x4F4,
1743  0x4F6, 0x4F6,
1744  0x4F8, 0x4F8,
1745  0x4FA, 0x4FA,
1746  0x4FC, 0x4FC,
1747  0x4FE, 0x4FE,
1748  0x500, 0x500,
1749  0x502, 0x502,
1750  0x504, 0x504,
1751  0x506, 0x506,
1752  0x508, 0x508,
1753  0x50A, 0x50A,
1754  0x50C, 0x50C,
1755  0x50E, 0x50E,
1756  0x510, 0x510,
1757  0x512, 0x512,
1758  0x514, 0x514,
1759  0x516, 0x516,
1760  0x518, 0x518,
1761  0x51A, 0x51A,
1762  0x51C, 0x51C,
1763  0x51E, 0x51E,
1764  0x520, 0x520,
1765  0x522, 0x522,
1766  0x524, 0x524,
1767  0x526, 0x526,
1768  0x528, 0x528,
1769  0x52A, 0x52A,
1770  0x52C, 0x52C,
1771  0x52E, 0x52E,
1772  0x531, 0x556,
1773  0x10A0, 0x10C5,
1774  0x10C7, 0x10C7,
1775  0x10CD, 0x10CD,
1776  0x13A0, 0x13F5,
1777  0x1C90, 0x1CBA,
1778  0x1CBD, 0x1CBF,
1779  0x1E00, 0x1E00,
1780  0x1E02, 0x1E02,
1781  0x1E04, 0x1E04,
1782  0x1E06, 0x1E06,
1783  0x1E08, 0x1E08,
1784  0x1E0A, 0x1E0A,
1785  0x1E0C, 0x1E0C,
1786  0x1E0E, 0x1E0E,
1787  0x1E10, 0x1E10,
1788  0x1E12, 0x1E12,
1789  0x1E14, 0x1E14,
1790  0x1E16, 0x1E16,
1791  0x1E18, 0x1E18,
1792  0x1E1A, 0x1E1A,
1793  0x1E1C, 0x1E1C,
1794  0x1E1E, 0x1E1E,
1795  0x1E20, 0x1E20,
1796  0x1E22, 0x1E22,
1797  0x1E24, 0x1E24,
1798  0x1E26, 0x1E26,
1799  0x1E28, 0x1E28,
1800  0x1E2A, 0x1E2A,
1801  0x1E2C, 0x1E2C,
1802  0x1E2E, 0x1E2E,
1803  0x1E30, 0x1E30,
1804  0x1E32, 0x1E32,
1805  0x1E34, 0x1E34,
1806  0x1E36, 0x1E36,
1807  0x1E38, 0x1E38,
1808  0x1E3A, 0x1E3A,
1809  0x1E3C, 0x1E3C,
1810  0x1E3E, 0x1E3E,
1811  0x1E40, 0x1E40,
1812  0x1E42, 0x1E42,
1813  0x1E44, 0x1E44,
1814  0x1E46, 0x1E46,
1815  0x1E48, 0x1E48,
1816  0x1E4A, 0x1E4A,
1817  0x1E4C, 0x1E4C,
1818  0x1E4E, 0x1E4E,
1819  0x1E50, 0x1E50,
1820  0x1E52, 0x1E52,
1821  0x1E54, 0x1E54,
1822  0x1E56, 0x1E56,
1823  0x1E58, 0x1E58,
1824  0x1E5A, 0x1E5A,
1825  0x1E5C, 0x1E5C,
1826  0x1E5E, 0x1E5E,
1827  0x1E60, 0x1E60,
1828  0x1E62, 0x1E62,
1829  0x1E64, 0x1E64,
1830  0x1E66, 0x1E66,
1831  0x1E68, 0x1E68,
1832  0x1E6A, 0x1E6A,
1833  0x1E6C, 0x1E6C,
1834  0x1E6E, 0x1E6E,
1835  0x1E70, 0x1E70,
1836  0x1E72, 0x1E72,
1837  0x1E74, 0x1E74,
1838  0x1E76, 0x1E76,
1839  0x1E78, 0x1E78,
1840  0x1E7A, 0x1E7A,
1841  0x1E7C, 0x1E7C,
1842  0x1E7E, 0x1E7E,
1843  0x1E80, 0x1E80,
1844  0x1E82, 0x1E82,
1845  0x1E84, 0x1E84,
1846  0x1E86, 0x1E86,
1847  0x1E88, 0x1E88,
1848  0x1E8A, 0x1E8A,
1849  0x1E8C, 0x1E8C,
1850  0x1E8E, 0x1E8E,
1851  0x1E90, 0x1E90,
1852  0x1E92, 0x1E92,
1853  0x1E94, 0x1E94,
1854  0x1E9E, 0x1E9E,
1855  0x1EA0, 0x1EA0,
1856  0x1EA2, 0x1EA2,
1857  0x1EA4, 0x1EA4,
1858  0x1EA6, 0x1EA6,
1859  0x1EA8, 0x1EA8,
1860  0x1EAA, 0x1EAA,
1861  0x1EAC, 0x1EAC,
1862  0x1EAE, 0x1EAE,
1863  0x1EB0, 0x1EB0,
1864  0x1EB2, 0x1EB2,
1865  0x1EB4, 0x1EB4,
1866  0x1EB6, 0x1EB6,
1867  0x1EB8, 0x1EB8,
1868  0x1EBA, 0x1EBA,
1869  0x1EBC, 0x1EBC,
1870  0x1EBE, 0x1EBE,
1871  0x1EC0, 0x1EC0,
1872  0x1EC2, 0x1EC2,
1873  0x1EC4, 0x1EC4,
1874  0x1EC6, 0x1EC6,
1875  0x1EC8, 0x1EC8,
1876  0x1ECA, 0x1ECA,
1877  0x1ECC, 0x1ECC,
1878  0x1ECE, 0x1ECE,
1879  0x1ED0, 0x1ED0,
1880  0x1ED2, 0x1ED2,
1881  0x1ED4, 0x1ED4,
1882  0x1ED6, 0x1ED6,
1883  0x1ED8, 0x1ED8,
1884  0x1EDA, 0x1EDA,
1885  0x1EDC, 0x1EDC,
1886  0x1EDE, 0x1EDE,
1887  0x1EE0, 0x1EE0,
1888  0x1EE2, 0x1EE2,
1889  0x1EE4, 0x1EE4,
1890  0x1EE6, 0x1EE6,
1891  0x1EE8, 0x1EE8,
1892  0x1EEA, 0x1EEA,
1893  0x1EEC, 0x1EEC,
1894  0x1EEE, 0x1EEE,
1895  0x1EF0, 0x1EF0,
1896  0x1EF2, 0x1EF2,
1897  0x1EF4, 0x1EF4,
1898  0x1EF6, 0x1EF6,
1899  0x1EF8, 0x1EF8,
1900  0x1EFA, 0x1EFA,
1901  0x1EFC, 0x1EFC,
1902  0x1EFE, 0x1EFE,
1903  0x1F08, 0x1F0F,
1904  0x1F18, 0x1F1D,
1905  0x1F28, 0x1F2F,
1906  0x1F38, 0x1F3F,
1907  0x1F48, 0x1F4D,
1908  0x1F59, 0x1F59,
1909  0x1F5B, 0x1F5B,
1910  0x1F5D, 0x1F5D,
1911  0x1F5F, 0x1F5F,
1912  0x1F68, 0x1F6F,
1913  0x1F88, 0x1F8F,
1914  0x1F98, 0x1F9F,
1915  0x1FA8, 0x1FAF,
1916  0x1FB8, 0x1FBC,
1917  0x1FC8, 0x1FCC,
1918  0x1FD8, 0x1FDB,
1919  0x1FE8, 0x1FEC,
1920  0x1FF8, 0x1FFC,
1921  0x2102, 0x2102,
1922  0x2107, 0x2107,
1923  0x210B, 0x210D,
1924  0x2110, 0x2112,
1925  0x2115, 0x2115,
1926  0x2119, 0x211D,
1927  0x2124, 0x2124,
1928  0x2126, 0x2126,
1929  0x2128, 0x2128,
1930  0x212A, 0x212D,
1931  0x2130, 0x2133,
1932  0x213E, 0x213F,
1933  0x2145, 0x2145,
1934  0x2160, 0x216F,
1935  0x2183, 0x2183,
1936  0x24B6, 0x24CF,
1937  0x2C00, 0x2C2F,
1938  0x2C60, 0x2C60,
1939  0x2C62, 0x2C64,
1940  0x2C67, 0x2C67,
1941  0x2C69, 0x2C69,
1942  0x2C6B, 0x2C6B,
1943  0x2C6D, 0x2C70,
1944  0x2C72, 0x2C72,
1945  0x2C75, 0x2C75,
1946  0x2C7E, 0x2C80,
1947  0x2C82, 0x2C82,
1948  0x2C84, 0x2C84,
1949  0x2C86, 0x2C86,
1950  0x2C88, 0x2C88,
1951  0x2C8A, 0x2C8A,
1952  0x2C8C, 0x2C8C,
1953  0x2C8E, 0x2C8E,
1954  0x2C90, 0x2C90,
1955  0x2C92, 0x2C92,
1956  0x2C94, 0x2C94,
1957  0x2C96, 0x2C96,
1958  0x2C98, 0x2C98,
1959  0x2C9A, 0x2C9A,
1960  0x2C9C, 0x2C9C,
1961  0x2C9E, 0x2C9E,
1962  0x2CA0, 0x2CA0,
1963  0x2CA2, 0x2CA2,
1964  0x2CA4, 0x2CA4,
1965  0x2CA6, 0x2CA6,
1966  0x2CA8, 0x2CA8,
1967  0x2CAA, 0x2CAA,
1968  0x2CAC, 0x2CAC,
1969  0x2CAE, 0x2CAE,
1970  0x2CB0, 0x2CB0,
1971  0x2CB2, 0x2CB2,
1972  0x2CB4, 0x2CB4,
1973  0x2CB6, 0x2CB6,
1974  0x2CB8, 0x2CB8,
1975  0x2CBA, 0x2CBA,
1976  0x2CBC, 0x2CBC,
1977  0x2CBE, 0x2CBE,
1978  0x2CC0, 0x2CC0,
1979  0x2CC2, 0x2CC2,
1980  0x2CC4, 0x2CC4,
1981  0x2CC6, 0x2CC6,
1982  0x2CC8, 0x2CC8,
1983  0x2CCA, 0x2CCA,
1984  0x2CCC, 0x2CCC,
1985  0x2CCE, 0x2CCE,
1986  0x2CD0, 0x2CD0,
1987  0x2CD2, 0x2CD2,
1988  0x2CD4, 0x2CD4,
1989  0x2CD6, 0x2CD6,
1990  0x2CD8, 0x2CD8,
1991  0x2CDA, 0x2CDA,
1992  0x2CDC, 0x2CDC,
1993  0x2CDE, 0x2CDE,
1994  0x2CE0, 0x2CE0,
1995  0x2CE2, 0x2CE2,
1996  0x2CEB, 0x2CEB,
1997  0x2CED, 0x2CED,
1998  0x2CF2, 0x2CF2,
1999  0xA640, 0xA640,
2000  0xA642, 0xA642,
2001  0xA644, 0xA644,
2002  0xA646, 0xA646,
2003  0xA648, 0xA648,
2004  0xA64A, 0xA64A,
2005  0xA64C, 0xA64C,
2006  0xA64E, 0xA64E,
2007  0xA650, 0xA650,
2008  0xA652, 0xA652,
2009  0xA654, 0xA654,
2010  0xA656, 0xA656,
2011  0xA658, 0xA658,
2012  0xA65A, 0xA65A,
2013  0xA65C, 0xA65C,
2014  0xA65E, 0xA65E,
2015  0xA660, 0xA660,
2016  0xA662, 0xA662,
2017  0xA664, 0xA664,
2018  0xA666, 0xA666,
2019  0xA668, 0xA668,
2020  0xA66A, 0xA66A,
2021  0xA66C, 0xA66C,
2022  0xA680, 0xA680,
2023  0xA682, 0xA682,
2024  0xA684, 0xA684,
2025  0xA686, 0xA686,
2026  0xA688, 0xA688,
2027  0xA68A, 0xA68A,
2028  0xA68C, 0xA68C,
2029  0xA68E, 0xA68E,
2030  0xA690, 0xA690,
2031  0xA692, 0xA692,
2032  0xA694, 0xA694,
2033  0xA696, 0xA696,
2034  0xA698, 0xA698,
2035  0xA69A, 0xA69A,
2036  0xA722, 0xA722,
2037  0xA724, 0xA724,
2038  0xA726, 0xA726,
2039  0xA728, 0xA728,
2040  0xA72A, 0xA72A,
2041  0xA72C, 0xA72C,
2042  0xA72E, 0xA72E,
2043  0xA732, 0xA732,
2044  0xA734, 0xA734,
2045  0xA736, 0xA736,
2046  0xA738, 0xA738,
2047  0xA73A, 0xA73A,
2048  0xA73C, 0xA73C,
2049  0xA73E, 0xA73E,
2050  0xA740, 0xA740,
2051  0xA742, 0xA742,
2052  0xA744, 0xA744,
2053  0xA746, 0xA746,
2054  0xA748, 0xA748,
2055  0xA74A, 0xA74A,
2056  0xA74C, 0xA74C,
2057  0xA74E, 0xA74E,
2058  0xA750, 0xA750,
2059  0xA752, 0xA752,
2060  0xA754, 0xA754,
2061  0xA756, 0xA756,
2062  0xA758, 0xA758,
2063  0xA75A, 0xA75A,
2064  0xA75C, 0xA75C,
2065  0xA75E, 0xA75E,
2066  0xA760, 0xA760,
2067  0xA762, 0xA762,
2068  0xA764, 0xA764,
2069  0xA766, 0xA766,
2070  0xA768, 0xA768,
2071  0xA76A, 0xA76A,
2072  0xA76C, 0xA76C,
2073  0xA76E, 0xA76E,
2074  0xA779, 0xA779,
2075  0xA77B, 0xA77B,
2076  0xA77D, 0xA77E,
2077  0xA780, 0xA780,
2078  0xA782, 0xA782,
2079  0xA784, 0xA784,
2080  0xA786, 0xA786,
2081  0xA78B, 0xA78B,
2082  0xA78D, 0xA78D,
2083  0xA790, 0xA790,
2084  0xA792, 0xA792,
2085  0xA796, 0xA796,
2086  0xA798, 0xA798,
2087  0xA79A, 0xA79A,
2088  0xA79C, 0xA79C,
2089  0xA79E, 0xA79E,
2090  0xA7A0, 0xA7A0,
2091  0xA7A2, 0xA7A2,
2092  0xA7A4, 0xA7A4,
2093  0xA7A6, 0xA7A6,
2094  0xA7A8, 0xA7A8,
2095  0xA7AA, 0xA7AE,
2096  0xA7B0, 0xA7B4,
2097  0xA7B6, 0xA7B6,
2098  0xA7B8, 0xA7B8,
2099  0xA7BA, 0xA7BA,
2100  0xA7BC, 0xA7BC,
2101  0xA7BE, 0xA7BE,
2102  0xA7C0, 0xA7C0,
2103  0xA7C2, 0xA7C2,
2104  0xA7C4, 0xA7C7,
2105  0xA7C9, 0xA7C9,
2106  0xA7D0, 0xA7D0,
2107  0xA7D6, 0xA7D6,
2108  0xA7D8, 0xA7D8,
2109  0xA7F5, 0xA7F5,
2110  0xFF21, 0xFF3A,
2111  0x10400, 0x10427,
2112  0x104B0, 0x104D3,
2113  0x10570, 0x1057A,
2114  0x1057C, 0x1058A,
2115  0x1058C, 0x10592,
2116  0x10594, 0x10595,
2117  0x10C80, 0x10CB2,
2118  0x118A0, 0x118BF,
2119  0x16E40, 0x16E5F,
2120  0x1D400, 0x1D419,
2121  0x1D434, 0x1D44D,
2122  0x1D468, 0x1D481,
2123  0x1D49C, 0x1D49C,
2124  0x1D49E, 0x1D49F,
2125  0x1D4A2, 0x1D4A2,
2126  0x1D4A5, 0x1D4A6,
2127  0x1D4A9, 0x1D4AC,
2128  0x1D4AE, 0x1D4B5,
2129  0x1D4D0, 0x1D4E9,
2130  0x1D504, 0x1D505,
2131  0x1D507, 0x1D50A,
2132  0x1D50D, 0x1D514,
2133  0x1D516, 0x1D51C,
2134  0x1D538, 0x1D539,
2135  0x1D53B, 0x1D53E,
2136  0x1D540, 0x1D544,
2137  0x1D546, 0x1D546,
2138  0x1D54A, 0x1D550,
2139  0x1D56C, 0x1D585,
2140  0x1D5A0, 0x1D5B9,
2141  0x1D5D4, 0x1D5ED,
2142  0x1D608, 0x1D621,
2143  0x1D63C, 0x1D655,
2144  0x1D670, 0x1D689,
2145  0x1D6A8, 0x1D6C0,
2146  0x1D6E2, 0x1D6FA,
2147  0x1D71C, 0x1D734,
2148  0x1D756, 0x1D76E,
2149  0x1D790, 0x1D7A8,
2150  0x1D7CA, 0x1D7CA,
2151  0x1E900, 0x1E921,
2152  0x1F130, 0x1F149,
2153  0x1F150, 0x1F169,
2154  0x1F170, 0x1F189,
2155 };
2156 
2164 const uint8_t pm_encoding_unicode_table[256] = {
2165 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2166  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2167  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2168  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2169  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2170  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2171  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2172  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2173  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2174  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2175  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2176  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
2177  0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
2178  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
2179  7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
2180  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
2181  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
2182 };
2183 
2188 static bool
2189 pm_unicode_codepoint_match(pm_unicode_codepoint_t codepoint, const pm_unicode_codepoint_t *codepoints, size_t size) {
2190  size_t start = 0;
2191  size_t end = size;
2192 
2193  while (start < end) {
2194  size_t middle = start + (end - start) / 2;
2195  if ((middle % 2) != 0) middle--;
2196 
2197  if (codepoint >= codepoints[middle] && codepoint <= codepoints[middle + 1]) {
2198  return true;
2199  }
2200 
2201  if (codepoint < codepoints[middle]) {
2202  end = middle;
2203  } else {
2204  start = middle + 2;
2205  }
2206  }
2207 
2208  return false;
2209 }
2210 
2234 static const uint8_t pm_utf_8_dfa[] = {
2235  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 00..1f
2236  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 20..3f
2237  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 40..5f
2238  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 60..7f
2239  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, // 80..9f
2240  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, // a0..bf
2241  8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // c0..df
2242  0xa,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x3, // e0..ef
2243  0xb,0x6,0x6,0x6,0x5,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, // f0..ff
2244  0x0,0x1,0x2,0x3,0x5,0x8,0x7,0x1,0x1,0x1,0x4,0x6,0x1,0x1,0x1,0x1, // s0..s0
2245  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1, // s1..s2
2246  1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1, // s3..s4
2247  1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,1,1,1, // s5..s6
2248  1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8
2249 };
2250 
2256 static pm_unicode_codepoint_t
2257 pm_utf_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
2258  assert(n >= 0);
2259 
2260  size_t maximum = (n > 4) ? 4 : ((size_t) n);
2261  uint32_t codepoint;
2262  uint32_t state = 0;
2263 
2264  for (size_t index = 0; index < maximum; index++) {
2265  uint32_t byte = b[index];
2266  uint32_t type = pm_utf_8_dfa[byte];
2267 
2268  codepoint = (state != 0) ?
2269  (byte & 0x3fu) | (codepoint << 6) :
2270  (0xffu >> type) & (byte);
2271 
2272  state = pm_utf_8_dfa[256 + (state * 16) + type];
2273  if (state == 0) {
2274  *width = index + 1;
2275  return (pm_unicode_codepoint_t) codepoint;
2276  }
2277  }
2278 
2279  *width = 0;
2280  return 0;
2281 }
2282 
2286 size_t
2287 pm_encoding_utf_8_char_width(const uint8_t *b, ptrdiff_t n) {
2288  assert(n >= 0);
2289 
2290  size_t maximum = (n > 4) ? 4 : ((size_t) n);
2291  uint32_t state = 0;
2292 
2293  for (size_t index = 0; index < maximum; index++) {
2294  state = pm_utf_8_dfa[256 + (state * 16) + pm_utf_8_dfa[b[index]]];
2295  if (state == 0) return index + 1;
2296  }
2297 
2298  return 0;
2299 }
2300 
2305 size_t
2306 pm_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n) {
2307  if (*b < 0x80) {
2309  }
2310 
2311  size_t width;
2312  pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
2313 
2314  if (codepoint <= 0xFF) {
2315  return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_ALPHABETIC_BIT) ? width : 0;
2316  } else {
2317  return pm_unicode_codepoint_match(codepoint, unicode_alpha_codepoints, UNICODE_ALPHA_CODEPOINTS_LENGTH) ? width : 0;
2318  }
2319 }
2320 
2325 size_t
2326 pm_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n) {
2327  if (*b < 0x80) {
2329  }
2330 
2331  size_t width;
2332  pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
2333 
2334  if (codepoint <= 0xFF) {
2335  return (pm_encoding_unicode_table[(uint8_t) codepoint] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? width : 0;
2336  } else {
2337  return pm_unicode_codepoint_match(codepoint, unicode_alnum_codepoints, UNICODE_ALNUM_CODEPOINTS_LENGTH) ? width : 0;
2338  }
2339 }
2340 
2345 bool
2346 pm_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n) {
2347  if (*b < 0x80) {
2348  return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
2349  }
2350 
2351  size_t width;
2352  pm_unicode_codepoint_t codepoint = pm_utf_8_codepoint(b, n, &width);
2353 
2354  if (codepoint <= 0xFF) {
2355  return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
2356  } else {
2357  return pm_unicode_codepoint_match(codepoint, unicode_isupper_codepoints, UNICODE_ISUPPER_CODEPOINTS_LENGTH) ? true : false;
2358  }
2359 }
2360 
2361 #ifndef PRISM_ENCODING_EXCLUDE_FULL
2362 
2363 static pm_unicode_codepoint_t
2364 pm_cesu_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
2365  if (b[0] < 0x80) {
2366  *width = 1;
2367  return (pm_unicode_codepoint_t) b[0];
2368  }
2369 
2370  if (n > 1 && b[0] >= 0xC2 && b[0] <= 0xDF && b[1] >= 0x80 && b[1] <= 0xBF) {
2371  *width = 2;
2372 
2373  // 110xxxxx 10xxxxxx
2374  return (pm_unicode_codepoint_t) (((b[0] & 0x1F) << 6) | (b[1] & 0x3F));
2375  }
2376 
2377  if (n > 5 && b[0] == 0xED && b[1] >= 0xA0 && b[1] <= 0xAF && b[2] >= 0x80 && b[2] <= 0xBF && b[3] == 0xED && b[4] >= 0xB0 && b[4] <= 0xBF && b[5] >= 0x80 && b[5] <= 0xBF) {
2378  *width = 6;
2379 
2380  // 11101101 1010xxxx 10xxxxxx 11101101 1011xxxx 10xxxxxx
2381  return (pm_unicode_codepoint_t) (0x10000 + (((b[1] & 0xF) << 16) | ((b[2] & 0x3F) << 10) | ((b[4] & 0xF) << 6) | (b[5] & 0x3F)));
2382  }
2383 
2384  if (n > 2 && b[0] == 0xED && b[1] >= 0xA0 && b[1] <= 0xBF) {
2385  *width = 3;
2386 
2387  // 11101101 1010xxxx 10xxxxx
2388  return (pm_unicode_codepoint_t) (0x10000 + (((b[0] & 0x03) << 16) | ((b[1] & 0x3F) << 10) | (b[2] & 0x3F)));
2389  }
2390 
2391  if (n > 2 && ((b[0] == 0xE0 && b[1] >= 0xA0) || (b[0] >= 0xE1 && b[0] <= 0xEF && b[1] >= 0x80)) && b[1] <= 0xBF && b[2] >= 0x80 && b[2] <= 0xBF) {
2392  *width = 3;
2393 
2394  // 1110xxxx 10xxxxxx 10xxxxx
2395  return (pm_unicode_codepoint_t) (((b[0] & 0xF) << 12) | ((b[1] & 0x3F) << 6) | (b[2] & 0x3F));
2396  }
2397 
2398  *width = 0;
2399  return 0;
2400 }
2401 
2402 static size_t
2403 pm_encoding_cesu_8_char_width(const uint8_t *b, ptrdiff_t n) {
2404  size_t width;
2405  pm_cesu_8_codepoint(b, n, &width);
2406  return width;
2407 }
2408 
2409 static size_t
2410 pm_encoding_cesu_8_alpha_char(const uint8_t *b, ptrdiff_t n) {
2411  if (*b < 0x80) {
2413  }
2414 
2415  size_t width;
2416  pm_unicode_codepoint_t codepoint = pm_cesu_8_codepoint(b, n, &width);
2417 
2418  if (codepoint <= 0xFF) {
2419  return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_ALPHABETIC_BIT) ? width : 0;
2420  } else {
2421  return pm_unicode_codepoint_match(codepoint, unicode_alpha_codepoints, UNICODE_ALPHA_CODEPOINTS_LENGTH) ? width : 0;
2422  }
2423 }
2424 
2425 static size_t
2426 pm_encoding_cesu_8_alnum_char(const uint8_t *b, ptrdiff_t n) {
2427  if (*b < 0x80) {
2429  }
2430 
2431  size_t width;
2432  pm_unicode_codepoint_t codepoint = pm_cesu_8_codepoint(b, n, &width);
2433 
2434  if (codepoint <= 0xFF) {
2435  return (pm_encoding_unicode_table[(uint8_t) codepoint] & (PRISM_ENCODING_ALPHANUMERIC_BIT)) ? width : 0;
2436  } else {
2437  return pm_unicode_codepoint_match(codepoint, unicode_alnum_codepoints, UNICODE_ALNUM_CODEPOINTS_LENGTH) ? width : 0;
2438  }
2439 }
2440 
2441 static bool
2442 pm_encoding_cesu_8_isupper_char(const uint8_t *b, ptrdiff_t n) {
2443  if (*b < 0x80) {
2444  return (pm_encoding_unicode_table[*b] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
2445  }
2446 
2447  size_t width;
2448  pm_unicode_codepoint_t codepoint = pm_cesu_8_codepoint(b, n, &width);
2449 
2450  if (codepoint <= 0xFF) {
2451  return (pm_encoding_unicode_table[(uint8_t) codepoint] & PRISM_ENCODING_UPPERCASE_BIT) ? true : false;
2452  } else {
2453  return pm_unicode_codepoint_match(codepoint, unicode_isupper_codepoints, UNICODE_ISUPPER_CODEPOINTS_LENGTH) ? true : false;
2454  }
2455 }
2456 
2457 #endif
2458 
2459 #undef UNICODE_ALPHA_CODEPOINTS_LENGTH
2460 #undef UNICODE_ALNUM_CODEPOINTS_LENGTH
2461 #undef UNICODE_ISUPPER_CODEPOINTS_LENGTH
2462 
2467 static const uint8_t pm_encoding_ascii_table[256] = {
2468 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2469  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2470  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2471  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2472  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2473  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2474  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2475  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2476  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2477  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2478  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2479  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2480  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2481  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2482  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2483  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2484  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2485 };
2486 
2487 #ifndef PRISM_ENCODING_EXCLUDE_FULL
2488 
2493 static const uint8_t pm_encoding_cp850_table[256] = {
2494 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2495  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2496  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2497  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2498  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2499  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2500  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2501  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2502  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2503  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2504  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2505  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2506  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2507  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2508  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2509  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2510  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2511 };
2512 
2517 static const uint8_t pm_encoding_cp852_table[256] = {
2518 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2519  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2520  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2521  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2522  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2523  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2524  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2525  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2526  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2527  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2528  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2529  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2530  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2531  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2532  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2533  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2534  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2535 };
2536 
2541 static const uint8_t pm_encoding_cp855_table[256] = {
2542 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2543  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2544  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2545  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2546  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2547  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2548  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2549  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2550  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2551  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2552  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2553  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2554  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2555  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2556  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2557  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2558  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2559 };
2560 
2565 static const uint8_t pm_encoding_gb1988_table[256] = {
2566 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2567  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2568  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2569  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2570  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2571  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2572  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2573  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2574  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2575  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2576  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2577  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2578  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2579  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2580  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2581  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2582  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2583 };
2584 
2589 static const uint8_t pm_encoding_ibm437_table[256] = {
2590 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2591  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2592  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2593  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2594  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2595  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2596  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2597  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2598  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2599  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2600  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2601  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2602  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2603  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2604  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2605  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2606  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2607 };
2608 
2613 static const uint8_t pm_encoding_ibm720_table[256] = {
2614 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2615  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2616  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2617  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2618  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2619  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2620  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2621  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2622  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2623  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2624  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2625  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2626  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2627  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2628  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2629  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2630  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2631 };
2632 
2637 static const uint8_t pm_encoding_ibm737_table[256] = {
2638 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2639  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2640  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2641  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2642  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2643  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2644  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2645  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2646  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2647  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2648  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2649  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2650  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2651  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2652  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2653  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2654  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2655 };
2656 
2661 static const uint8_t pm_encoding_ibm775_table[256] = {
2662 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2663  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2664  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2665  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2666  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2667  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2668  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2669  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2670  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2671  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2672  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2673  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2674  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2675  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2676  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2677  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2678  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2679 };
2680 
2685 static const uint8_t pm_encoding_ibm852_table[256] = {
2686 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2687  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2688  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2689  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2690  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2691  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2692  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2693  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2694  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2695  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2696  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2697  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2698  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2699  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2700  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2701  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2702  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2703 };
2704 
2709 static const uint8_t pm_encoding_ibm855_table[256] = {
2710 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2711  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2712  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2713  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2714  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2715  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2716  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2717  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2718  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2719  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2720  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2721  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2722  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2723  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2724  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2725  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2726  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2727 };
2728 
2733 static const uint8_t pm_encoding_ibm857_table[256] = {
2734 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2735  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2736  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2737  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2738  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2739  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2740  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2741  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2742  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2743  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2744  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2745  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2746  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2747  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2748  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2749  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2750  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2751 };
2752 
2757 static const uint8_t pm_encoding_ibm860_table[256] = {
2758 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2759  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2760  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2761  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2762  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2763  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2764  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2765  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2766  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2767  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2768  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2769  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2770  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2771  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2772  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2773  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2774  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2775 };
2776 
2781 static const uint8_t pm_encoding_ibm861_table[256] = {
2782 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2783  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2784  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2785  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2786  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2787  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2788  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2789  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2790  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2791  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2792  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2793  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2794  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2795  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2796  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2797  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2798  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2799 };
2800 
2805 static const uint8_t pm_encoding_ibm862_table[256] = {
2806 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2807  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2808  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2809  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2810  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2811  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2812  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2813  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2814  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2815  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2816  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2817  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2818  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2819  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2820  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2821  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2822  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2823 };
2824 
2829 static const uint8_t pm_encoding_ibm863_table[256] = {
2830 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2831  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2832  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2833  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2834  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2835  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2836  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2837  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2838  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2839  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2840  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2841  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2842  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2843  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2844  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2845  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2846  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2847 };
2848 
2853 static const uint8_t pm_encoding_ibm864_table[256] = {
2854 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2855  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2856  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2857  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2858  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2859  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2860  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2861  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2862  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2863  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2864  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2865  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2866  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2867  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2868  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2869  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2870  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2871 };
2872 
2877 static const uint8_t pm_encoding_ibm865_table[256] = {
2878 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2879  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2880  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2881  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2882  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2883  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2884  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2885  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2886  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2887  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2888  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2889  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2890  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2891  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2892  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2893  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2894  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2895 };
2896 
2901 static const uint8_t pm_encoding_ibm866_table[256] = {
2902 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2903  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2904  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2905  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2906  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2907  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2908  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2909  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2910  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2911  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2912  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2913  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2914  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2915  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2916  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2917  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2918  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2919 };
2920 
2925 static const uint8_t pm_encoding_ibm869_table[256] = {
2926 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2927  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2928  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2929  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2930  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2931  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2932  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2933  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2934  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2935  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2936  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2937  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
2938  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
2939  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
2940  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
2941  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
2942  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
2943 };
2944 
2949 static const uint8_t pm_encoding_iso_8859_1_table[256] = {
2950 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2951  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2952  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2953  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2954  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2955  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2956  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2957  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2958  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2959  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2960  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2961  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
2962  0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
2963  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
2964  7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
2965  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
2966  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
2967 };
2968 
2973 static const uint8_t pm_encoding_iso_8859_2_table[256] = {
2974 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2975  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
2976  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
2977  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
2978  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
2979  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
2980  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
2981  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
2982  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
2983  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
2984  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
2985  0, 7, 0, 7, 0, 7, 7, 0, 0, 7, 7, 7, 7, 0, 7, 7, // Ax
2986  0, 3, 0, 3, 0, 3, 3, 0, 0, 3, 3, 3, 3, 0, 3, 3, // Bx
2987  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
2988  7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
2989  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
2990  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
2991 };
2992 
2997 static const uint8_t pm_encoding_iso_8859_3_table[256] = {
2998 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2999  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3000  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3001  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3002  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3003  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3004  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3005  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3006  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3007  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3008  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3009  0, 7, 0, 0, 0, 0, 7, 0, 0, 7, 7, 7, 7, 0, 0, 7, // Ax
3010  0, 3, 0, 0, 0, 3, 3, 0, 0, 3, 3, 3, 3, 0, 0, 3, // Bx
3011  7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3012  0, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3013  3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3014  0, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3015 };
3016 
3021 static const uint8_t pm_encoding_iso_8859_4_table[256] = {
3022 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3023  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3024  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3025  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3026  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3027  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3028  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3029  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3030  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3031  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3032  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3033  0, 7, 3, 7, 0, 7, 7, 0, 0, 7, 7, 7, 7, 0, 7, 0, // Ax
3034  0, 3, 0, 3, 0, 3, 3, 0, 0, 3, 3, 3, 3, 7, 3, 3, // Bx
3035  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3036  7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3037  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3038  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3039 };
3040 
3045 static const uint8_t pm_encoding_iso_8859_5_table[256] = {
3046 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3047  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3048  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3049  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3050  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3051  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3052  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3053  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3054  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3055  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3056  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3057  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, // Ax
3058  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Bx
3059  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3060  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Dx
3061  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3062  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, // Fx
3063 };
3064 
3069 static const uint8_t pm_encoding_iso_8859_6_table[256] = {
3070 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3071  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3072  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3073  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3074  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3075  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3076  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3077  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3078  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3079  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3080  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3081  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3082  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3083  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3084  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // Dx
3085  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3086  3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3087 };
3088 
3093 static const uint8_t pm_encoding_iso_8859_7_table[256] = {
3094 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3095  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3096  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3097  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3098  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3099  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3100  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3101  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3102  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3103  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3104  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3105  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3106  0, 0, 0, 0, 0, 0, 7, 0, 7, 7, 7, 0, 7, 0, 7, 7, // Bx
3107  3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3108  7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, // Dx
3109  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3110  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3111 };
3112 
3117 static const uint8_t pm_encoding_iso_8859_8_table[256] = {
3118 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3119  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3120  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3121  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3122  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3123  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3124  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3125  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3126  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3127  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3128  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3129  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3130  0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3131  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3132  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3133  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3134  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // Fx
3135 };
3136 
3141 static const uint8_t pm_encoding_iso_8859_9_table[256] = {
3142 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3143  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3144  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3145  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3146  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3147  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3148  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3149  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3150  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3151  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3152  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3153  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
3154  0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
3155  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3156  7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3157  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3158  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3159 };
3160 
3165 static const uint8_t pm_encoding_iso_8859_10_table[256] = {
3166 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3167  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3168  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3169  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3170  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3171  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3172  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3173  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3174  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3175  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3176  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3177  0, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 0, 7, 7, // Ax
3178  0, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 3, // Bx
3179  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3180  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3181  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3182  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3183 };
3184 
3189 static const uint8_t pm_encoding_iso_8859_11_table[256] = {
3190 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3191  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3192  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3193  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3194  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3195  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3196  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3197  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3198  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3199  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3200  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3201  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ax
3202  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Bx
3203  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3204  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, // Dx
3205  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3206  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, // Fx
3207 };
3208 
3213 static const uint8_t pm_encoding_iso_8859_13_table[256] = {
3214 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3215  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3216  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3217  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3218  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3219  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3220  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3221  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3222  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3223  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3224  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3225  0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, // Ax
3226  0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 3, 0, 0, 0, 0, 3, // Bx
3227  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3228  7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3229  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3230  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3231 };
3232 
3237 static const uint8_t pm_encoding_iso_8859_14_table[256] = {
3238 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3239  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3240  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3241  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3242  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3243  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3244  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3245  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3246  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3247  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3248  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3249  0, 7, 3, 0, 7, 3, 7, 0, 7, 0, 7, 3, 7, 0, 0, 7, // Ax
3250  7, 3, 7, 3, 7, 3, 0, 7, 3, 3, 3, 7, 3, 7, 3, 3, // Bx
3251  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3252  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3253  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3254  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3255 };
3256 
3261 static const uint8_t pm_encoding_iso_8859_15_table[256] = {
3262 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3263  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3264  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3265  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3266  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3267  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3268  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3269  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3270  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3271  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3272  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3273  0, 0, 0, 0, 0, 0, 7, 0, 3, 0, 3, 0, 0, 0, 0, 0, // Ax
3274  0, 0, 0, 0, 7, 3, 0, 0, 3, 0, 3, 0, 7, 3, 7, 0, // Bx
3275  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3276  7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3277  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3278  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3279 };
3280 
3285 static const uint8_t pm_encoding_iso_8859_16_table[256] = {
3286 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3287  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3288  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3289  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3290  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3291  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3292  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3293  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3294  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3295  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3296  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3297  0, 7, 3, 7, 0, 0, 7, 0, 3, 0, 7, 0, 7, 0, 3, 7, // Ax
3298  0, 0, 7, 3, 7, 0, 0, 0, 3, 3, 3, 0, 7, 3, 7, 3, // Bx
3299  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3300  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3301  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3302  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3303 };
3304 
3309 static const uint8_t pm_encoding_koi8_r_table[256] = {
3310 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3311  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3312  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3313  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3314  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3315  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3316  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3317  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3318  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3319  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3320  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3321  0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3322  0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3323  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3324  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Dx
3325  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Ex
3326  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Fx
3327 };
3328 
3333 static const uint8_t pm_encoding_koi8_u_table[256] = {
3334 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3335  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3336  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3337  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3338  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3339  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3340  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3341  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3342  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3343  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3344  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3345  0, 0, 0, 3, 3, 0, 3, 3, 0, 0, 0, 0, 0, 3, 0, 0, // Ax
3346  0, 0, 0, 7, 7, 0, 7, 7, 0, 0, 0, 0, 0, 7, 0, 0, // Bx
3347  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3348  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Dx
3349  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Ex
3350  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Fx
3351 };
3352 
3357 static const uint8_t pm_encoding_mac_cent_euro_table[256] = {
3358 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3359  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3360  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3361  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3362  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3363  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3364  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3365  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3366  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3367  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3368  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3369  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3370  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3371  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3372  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3373  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3374  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3375 };
3376 
3381 static const uint8_t pm_encoding_mac_croatian_table[256] = {
3382 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3383  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3384  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3385  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3386  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3387  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3388  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3389  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3390  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3391  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3392  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3393  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3394  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3395  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3396  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3397  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3398  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3399 };
3400 
3405 static const uint8_t pm_encoding_mac_cyrillic_table[256] = {
3406 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3407  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3408  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3409  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3410  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3411  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3412  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3413  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3414  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3415  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3416  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3417  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3418  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3419  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3420  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3421  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3422  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3423 };
3424 
3429 static const uint8_t pm_encoding_mac_greek_table[256] = {
3430 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3431  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3432  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3433  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3434  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3435  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3436  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3437  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3438  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3439  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3440  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3441  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3442  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3443  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3444  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3445  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3446  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3447 };
3448 
3453 static const uint8_t pm_encoding_mac_iceland_table[256] = {
3454 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3455  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3456  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3457  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3458  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3459  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3460  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3461  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3462  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3463  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3464  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3465  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3466  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3467  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3468  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3469  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3470  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3471 };
3472 
3477 static const uint8_t pm_encoding_mac_roman_table[256] = {
3478 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3479  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3480  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3481  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3482  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3483  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3484  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3485  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3486  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3487  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3488  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3489  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3490  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3491  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3492  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3493  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3494  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3495 };
3496 
3501 static const uint8_t pm_encoding_mac_romania_table[256] = {
3502 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3503  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3504  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3505  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3506  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3507  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3508  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3509  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3510  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3511  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3512  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3513  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3514  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3515  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3516  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3517  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3518  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3519 };
3520 
3525 static const uint8_t pm_encoding_mac_thai_table[256] = {
3526 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3527  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3528  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3529  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3530  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3531  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3532  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3533  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3534  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3535  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3536  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3537  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3538  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3539  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3540  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3541  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3542  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3543 };
3544 
3549 static const uint8_t pm_encoding_tis_620_table[256] = {
3550 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3551  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3552  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3553  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3554  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3555  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3556  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3557  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3558  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3559  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3560  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3561  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ax
3562  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Bx
3563  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3564  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 3, // Dx
3565  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3566  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, // Fx
3567 };
3568 
3573 static const uint8_t pm_encoding_mac_turkish_table[256] = {
3574 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3575  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3576  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3577  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3578  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3579  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3580  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3581  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3582  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3583  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3584  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3585  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3586  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3587  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3588  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3589  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3590  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3591 };
3592 
3597 static const uint8_t pm_encoding_mac_ukraine_table[256] = {
3598 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3599  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3600  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3601  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3602  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3603  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3604  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3605  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3606  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3607  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3608  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3609  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3610  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3611  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3612  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3613  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3614  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3615 };
3616 
3621 static const uint8_t pm_encoding_windows_1250_table[256] = {
3622 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3623  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3624  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3625  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3626  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3627  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3628  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3629  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3630  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3631  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 7, 7, 7, // 8x
3632  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 3, 3, 3, // 9x
3633  0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, // Ax
3634  0, 0, 0, 3, 0, 3, 0, 0, 0, 3, 3, 0, 7, 0, 3, 3, // Bx
3635  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3636  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3637  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3638  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3639 };
3640 
3645 static const uint8_t pm_encoding_windows_1251_table[256] = {
3646 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3647  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3648  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3649  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3650  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3651  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3652  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3653  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3654  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3655  7, 7, 0, 3, 0, 0, 0, 0, 0, 0, 7, 0, 7, 7, 7, 7, // 8x
3656  3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 3, 3, 3, // 9x
3657  0, 7, 3, 7, 0, 7, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, // Ax
3658  0, 0, 7, 3, 3, 3, 0, 0, 3, 0, 3, 0, 3, 7, 3, 3, // Bx
3659  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3660  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Dx
3661  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3662  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3663 };
3664 
3669 static const uint8_t pm_encoding_windows_1252_table[256] = {
3670 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3671  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3672  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3673  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3674  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3675  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3676  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3677  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3678  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3679  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 7, 0, // 8x
3680  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 0, 3, 7, // 9x
3681  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
3682  0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
3683  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3684  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3685  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3686  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3687 };
3688 
3693 static const uint8_t pm_encoding_windows_1253_table[256] = {
3694 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3695  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3696  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3697  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3698  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3699  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3700  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3701  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3702  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3703  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3704  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3705  0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3706  0, 0, 0, 0, 0, 3, 7, 0, 7, 7, 7, 0, 7, 0, 7, 7, // Bx
3707  3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3708  7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, // Dx
3709  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3710  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3711 };
3712 
3717 static const uint8_t pm_encoding_windows_1254_table[256] = {
3718 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3719  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3720  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3721  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3722  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3723  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3724  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3725  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3726  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3727  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, // 8x
3728  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3, 0, 0, 7, // 9x
3729  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Ax
3730  0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, // Bx
3731  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3732  7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3733  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3734  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, // Fx
3735 };
3736 
3741 static const uint8_t pm_encoding_windows_1255_table[256] = {
3742 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3743  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3744  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3745  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3746  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3747  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3748  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3749  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3750  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3751  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3752  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3753  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3754  0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3755  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3756  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3757  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3758  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // Fx
3759 };
3760 
3765 static const uint8_t pm_encoding_windows_1256_table[256] = {
3766 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3767  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3768  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3769  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3770  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3771  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3772  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3773  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3774  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3775  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3776  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3777  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3778  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3779  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Cx
3780  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // Dx
3781  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3782  3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3783 };
3784 
3789 static const uint8_t pm_encoding_windows_1257_table[256] = {
3790 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3791  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3792  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3793  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3794  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3795  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3796  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3797  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3798  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3799  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3800  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3801  0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 7, // Ax
3802  0, 0, 0, 0, 0, 3, 0, 0, 3, 0, 3, 0, 0, 0, 0, 3, // Bx
3803  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Cx
3804  7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 3, // Dx
3805  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // Ex
3806  3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, // Fx
3807 };
3808 
3813 static const uint8_t pm_encoding_windows_1258_table[256] = {
3814 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3815  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3816  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3817  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3818  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3819  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3820  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3821  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3822  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3823  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3824  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3825  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3826  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3827  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3828  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3829  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3830  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3831 };
3832 
3837 static const uint8_t pm_encoding_windows_874_table[256] = {
3838 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
3839  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
3840  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
3841  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
3842  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
3843  0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
3844  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
3845  0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
3846  3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
3847  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
3848  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
3849  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
3850  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
3851  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
3852  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
3853  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
3854  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
3855 };
3856 
3857 #define PRISM_ENCODING_TABLE(name) \
3858  static size_t pm_encoding_ ##name ## _alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \
3859  return (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHABETIC_BIT); \
3860  } \
3861  static size_t pm_encoding_ ##name ## _alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \
3862  return (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0; \
3863  } \
3864  static bool pm_encoding_ ##name ## _isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { \
3865  return (pm_encoding_ ##name ## _table[*b] & PRISM_ENCODING_UPPERCASE_BIT); \
3866  }
3867 
3868 PRISM_ENCODING_TABLE(cp850)
3869 PRISM_ENCODING_TABLE(cp852)
3870 PRISM_ENCODING_TABLE(cp855)
3871 PRISM_ENCODING_TABLE(gb1988)
3872 PRISM_ENCODING_TABLE(ibm437)
3873 PRISM_ENCODING_TABLE(ibm720)
3874 PRISM_ENCODING_TABLE(ibm737)
3875 PRISM_ENCODING_TABLE(ibm775)
3876 PRISM_ENCODING_TABLE(ibm852)
3877 PRISM_ENCODING_TABLE(ibm855)
3878 PRISM_ENCODING_TABLE(ibm857)
3879 PRISM_ENCODING_TABLE(ibm860)
3880 PRISM_ENCODING_TABLE(ibm861)
3881 PRISM_ENCODING_TABLE(ibm862)
3882 PRISM_ENCODING_TABLE(ibm863)
3883 PRISM_ENCODING_TABLE(ibm864)
3884 PRISM_ENCODING_TABLE(ibm865)
3885 PRISM_ENCODING_TABLE(ibm866)
3886 PRISM_ENCODING_TABLE(ibm869)
3887 PRISM_ENCODING_TABLE(iso_8859_1)
3888 PRISM_ENCODING_TABLE(iso_8859_2)
3889 PRISM_ENCODING_TABLE(iso_8859_3)
3890 PRISM_ENCODING_TABLE(iso_8859_4)
3891 PRISM_ENCODING_TABLE(iso_8859_5)
3892 PRISM_ENCODING_TABLE(iso_8859_6)
3893 PRISM_ENCODING_TABLE(iso_8859_7)
3894 PRISM_ENCODING_TABLE(iso_8859_8)
3895 PRISM_ENCODING_TABLE(iso_8859_9)
3896 PRISM_ENCODING_TABLE(iso_8859_10)
3897 PRISM_ENCODING_TABLE(iso_8859_11)
3898 PRISM_ENCODING_TABLE(iso_8859_13)
3899 PRISM_ENCODING_TABLE(iso_8859_14)
3900 PRISM_ENCODING_TABLE(iso_8859_15)
3901 PRISM_ENCODING_TABLE(iso_8859_16)
3902 PRISM_ENCODING_TABLE(koi8_r)
3903 PRISM_ENCODING_TABLE(koi8_u)
3904 PRISM_ENCODING_TABLE(mac_cent_euro)
3905 PRISM_ENCODING_TABLE(mac_croatian)
3906 PRISM_ENCODING_TABLE(mac_cyrillic)
3907 PRISM_ENCODING_TABLE(mac_greek)
3908 PRISM_ENCODING_TABLE(mac_iceland)
3909 PRISM_ENCODING_TABLE(mac_roman)
3910 PRISM_ENCODING_TABLE(mac_romania)
3911 PRISM_ENCODING_TABLE(mac_thai)
3912 PRISM_ENCODING_TABLE(mac_turkish)
3913 PRISM_ENCODING_TABLE(mac_ukraine)
3914 PRISM_ENCODING_TABLE(tis_620)
3915 PRISM_ENCODING_TABLE(windows_1250)
3916 PRISM_ENCODING_TABLE(windows_1251)
3917 PRISM_ENCODING_TABLE(windows_1252)
3918 PRISM_ENCODING_TABLE(windows_1253)
3919 PRISM_ENCODING_TABLE(windows_1254)
3920 PRISM_ENCODING_TABLE(windows_1255)
3921 PRISM_ENCODING_TABLE(windows_1256)
3922 PRISM_ENCODING_TABLE(windows_1257)
3923 PRISM_ENCODING_TABLE(windows_1258)
3924 PRISM_ENCODING_TABLE(windows_874)
3925 
3926 #undef PRISM_ENCODING_TABLE
3927 #endif
3928 
3933 static size_t
3934 pm_encoding_ascii_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
3935  return *b < 0x80 ? 1 : 0;
3936 }
3937 
3942 static size_t
3943 pm_encoding_ascii_alpha_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
3944  return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHABETIC_BIT);
3945 }
3946 
3952 static size_t
3953 pm_encoding_ascii_alpha_char_7bit(const uint8_t *b, ptrdiff_t n) {
3954  return (*b < 0x80) ? pm_encoding_ascii_alpha_char(b, n) : 0;
3955 }
3956 
3961 static size_t
3962 pm_encoding_ascii_alnum_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
3963  return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_ALPHANUMERIC_BIT) ? 1 : 0;
3964 }
3965 
3971 static size_t
3972 pm_encoding_ascii_alnum_char_7bit(const uint8_t *b, ptrdiff_t n) {
3973  return (*b < 0x80) ? pm_encoding_ascii_alnum_char(b, n) : 0;
3974 }
3975 
3980 static bool
3981 pm_encoding_ascii_isupper_char(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
3982  return (pm_encoding_ascii_table[*b] & PRISM_ENCODING_UPPERCASE_BIT);
3983 }
3984 
3989 static size_t
3990 pm_encoding_single_char_width(PRISM_ATTRIBUTE_UNUSED const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) {
3991  return 1;
3992 }
3993 
3998 static size_t
3999 pm_encoding_euc_jp_char_width(const uint8_t *b, ptrdiff_t n) {
4000  // These are the single byte characters.
4001  if (*b < 0x80) {
4002  return 1;
4003  }
4004 
4005  // These are the double byte characters.
4006  if ((n > 1) && ((b[0] == 0x8E) || (b[0] >= 0xA1 && b[0] <= 0xFE)) && (b[1] >= 0xA1 && b[1] <= 0xFE)) {
4007  return 2;
4008  }
4009 
4010  // These are the triple byte characters.
4011  if ((n > 2) && (b[0] == 0x8F) && (b[1] >= 0xA1 && b[2] <= 0xFE) && (b[2] >= 0xA1 && b[2] <= 0xFE)) {
4012  return 3;
4013  }
4014 
4015  return 0;
4016 }
4017 
4022 static bool
4023 pm_encoding_euc_jp_isupper_char(const uint8_t *b, ptrdiff_t n) {
4024  size_t width = pm_encoding_euc_jp_char_width(b, n);
4025 
4026  if (width == 1) {
4027  return pm_encoding_ascii_isupper_char(b, n);
4028  } else if (width == 2) {
4029  return (
4030  (b[0] == 0xA3 && b[1] >= 0xC1 && b[1] <= 0xDA) ||
4031  (b[0] == 0xA6 && b[1] >= 0xA1 && b[1] <= 0xB8) ||
4032  (b[0] == 0xA7 && b[1] >= 0xA1 && b[1] <= 0xC1)
4033  );
4034  } else {
4035  return false;
4036  }
4037 }
4038 
4043 static size_t
4044 pm_encoding_shift_jis_char_width(const uint8_t *b, ptrdiff_t n) {
4045  // These are the single byte characters.
4046  if (b[0] < 0x80 || (b[0] >= 0xA1 && b[0] <= 0xDF)) {
4047  return 1;
4048  }
4049 
4050  // These are the double byte characters.
4051  if ((n > 1) && ((b[0] >= 0x81 && b[0] <= 0x9F) || (b[0] >= 0xE0 && b[0] <= 0xFC)) && (b[1] >= 0x40 && b[1] <= 0xFC && b[1] != 0x7F)) {
4052  return 2;
4053  }
4054 
4055  return 0;
4056 }
4057 
4062 static size_t
4063 pm_encoding_shift_jis_alnum_char(const uint8_t *b, ptrdiff_t n) {
4064  size_t width = pm_encoding_shift_jis_char_width(b, n);
4065  return width == 1 ? ((b[0] >= 0x80) || pm_encoding_ascii_alnum_char(b, n)) : width;
4066 }
4067 
4072 static size_t
4073 pm_encoding_shift_jis_alpha_char(const uint8_t *b, ptrdiff_t n) {
4074  size_t width = pm_encoding_shift_jis_char_width(b, n);
4075  return width == 1 ? ((b[0] >= 0x80) || pm_encoding_ascii_alpha_char(b, n)) : width;
4076 }
4077 
4082 static bool
4083 pm_encoding_shift_jis_isupper_char(const uint8_t *b, ptrdiff_t n) {
4084  size_t width = pm_encoding_shift_jis_char_width(b, n);
4085 
4086  if (width == 1) {
4087  return pm_encoding_ascii_isupper_char(b, n);
4088  } else if (width == 2) {
4089  return (
4090  ((b[0] == 0x82) && (b[1] >= 0x60 && b[1] <= 0x79)) ||
4091  ((b[0] == 0x83) && (b[1] >= 0x9F && b[1] <= 0xB6)) ||
4092  ((b[0] == 0x84) && (b[1] >= 0x40 && b[1] <= 0x60))
4093  );
4094  } else {
4095  return width;
4096  }
4097 }
4098 
4099 #ifndef PRISM_ENCODING_EXCLUDE_FULL
4100 
4106 static bool
4107 pm_encoding_ascii_isupper_char_7bit(const uint8_t *b, ptrdiff_t n) {
4108  return (*b < 0x80) && pm_encoding_ascii_isupper_char(b, n);
4109 }
4110 
4115 static size_t
4116 pm_encoding_big5_char_width(const uint8_t *b, ptrdiff_t n) {
4117  // These are the single byte characters.
4118  if (*b < 0x80) {
4119  return 1;
4120  }
4121 
4122  // These are the double byte characters.
4123  if ((n > 1) && (b[0] >= 0xA1 && b[0] <= 0xFE) && ((b[1] >= 0x40 && b[1] <= 0x7E) || (b[1] >= 0xA1 && b[1] <= 0xFE))) {
4124  return 2;
4125  }
4126 
4127  return 0;
4128 }
4129 
4134 static size_t
4135 pm_encoding_cp949_char_width(const uint8_t *b, ptrdiff_t n) {
4136  // These are the single byte characters
4137  if (*b <= 0x80) {
4138  return 1;
4139  }
4140 
4141  // These are the double byte characters
4142  if ((n > 1) && (b[0] >= 0x81 && b[0] <= 0xFE) && ((b[1] >= 0x41 && b[1] <= 0x5A) || (b[1] >= 0x61 && b[1] <= 0x7A) || (b[1] >= 0x81 && b[1] <= 0xFE))) {
4143  return 2;
4144  }
4145 
4146  return 0;
4147 }
4148 
4153 static size_t
4154 pm_encoding_emacs_mule_char_width(const uint8_t *b, ptrdiff_t n) {
4155  // These are the 1 byte characters.
4156  if (*b < 0x80) {
4157  return 1;
4158  }
4159 
4160  // These are the 2 byte characters.
4161  if ((n > 1) && (b[0] >= 0x81 && b[0] <= 0x8F) && (b[1] >= 0xA0)) {
4162  return 2;
4163  }
4164 
4165  // These are the 3 byte characters.
4166  if (
4167  (n > 2) &&
4168  (
4169  ((b[0] >= 0x90 && b[0] <= 0x99) && (b[1] >= 0xA0)) ||
4170  ((b[0] == 0x9A || b[0] == 0x9B) && (b[1] >= 0xE0 && b[1] <= 0xEF))
4171  ) &&
4172  (b[2] >= 0xA0)
4173  ) {
4174  return 3;
4175  }
4176 
4177  // These are the 4 byte characters.
4178  if (
4179  (n > 3) &&
4180  (
4181  ((b[0] == 0x9C) && (b[1] >= 0xF0) && (b[1] <= 0xF4)) ||
4182  ((b[0] == 0x9D) && (b[1] >= 0xF5) && (b[1] <= 0xFE))
4183  ) &&
4184  (b[2] >= 0xA0) && (b[3] >= 0xA0)
4185  ) {
4186  return 4;
4187  }
4188 
4189  return 0;
4190 }
4191 
4196 static size_t
4197 pm_encoding_euc_kr_char_width(const uint8_t *b, ptrdiff_t n) {
4198  // These are the single byte characters.
4199  if (*b < 0x80) {
4200  return 1;
4201  }
4202 
4203  // These are the double byte characters.
4204  if ((n > 1) && (b[0] >= 0xA1 && b[0] <= 0xFE) && (b[1] >= 0xA1 && b[1] <= 0xFE)) {
4205  return 2;
4206  }
4207 
4208  return 0;
4209 }
4210 
4215 static size_t
4216 pm_encoding_euc_tw_char_width(const uint8_t *b, ptrdiff_t n) {
4217  // These are the single byte characters.
4218  if (*b < 0x80) {
4219  return 1;
4220  }
4221 
4222  // These are the double byte characters.
4223  if ((n > 1) && (b[0] >= 0xA1) && (b[0] <= 0xFE) && (b[1] >= 0xA1) && (b[1] <= 0xFE)) {
4224  return 2;
4225  }
4226 
4227  // These are the quadruple byte characters.
4228  if ((n > 3) && (b[0] == 0x8E) && (b[1] >= 0xA1) && (b[1] <= 0xB0) && (b[2] >= 0xA1) && (b[2] <= 0xFE) && (b[3] >= 0xA1) && (b[3] <= 0xFE)) {
4229  return 4;
4230  }
4231 
4232  return 0;
4233 }
4234 
4239 static size_t
4240 pm_encoding_gb18030_char_width(const uint8_t *b, ptrdiff_t n) {
4241  // These are the 1 byte characters.
4242  if (*b < 0x80) {
4243  return 1;
4244  }
4245 
4246  // These are the 2 byte characters.
4247  if ((n > 1) && (b[0] >= 0x81 && b[0] <= 0xFE) && (b[1] >= 0x40 && b[1] <= 0xFE && b[1] != 0x7F)) {
4248  return 2;
4249  }
4250 
4251  // These are the 4 byte characters.
4252  if ((n > 3) && ((b[0] >= 0x81 && b[0] <= 0xFE) && (b[1] >= 0x30 && b[1] <= 0x39) && (b[2] >= 0x81 && b[2] <= 0xFE) && (b[3] >= 0x30 && b[3] <= 0x39))) {
4253  return 4;
4254  }
4255 
4256  return 0;
4257 }
4258 
4263 static size_t
4264 pm_encoding_gbk_char_width(const uint8_t *b, ptrdiff_t n) {
4265  // These are the single byte characters.
4266  if (*b <= 0x80) {
4267  return 1;
4268  }
4269 
4270  // These are the double byte characters.
4271  if (
4272  (n > 1) &&
4273  (
4274  ((b[0] >= 0xA1 && b[0] <= 0xA9) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // GBK/1
4275  ((b[0] >= 0xB0 && b[0] <= 0xF7) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // GBK/2
4276  ((b[0] >= 0x81 && b[0] <= 0xA0) && (b[1] >= 0x40 && b[1] <= 0xFE) && (b[1] != 0x7F)) || // GBK/3
4277  ((b[0] >= 0xAA && b[0] <= 0xFE) && (b[1] >= 0x40 && b[1] <= 0xA0) && (b[1] != 0x7F)) || // GBK/4
4278  ((b[0] >= 0xA8 && b[0] <= 0xA9) && (b[1] >= 0x40 && b[1] <= 0xA0) && (b[1] != 0x7F)) || // GBK/5
4279  ((b[0] >= 0xAA && b[0] <= 0xAF) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // user-defined 1
4280  ((b[0] >= 0xF8 && b[0] <= 0xFE) && (b[1] >= 0xA1 && b[1] <= 0xFE)) || // user-defined 2
4281  ((b[0] >= 0xA1 && b[0] <= 0xA7) && (b[1] >= 0x40 && b[1] <= 0xA0) && (b[1] != 0x7F)) // user-defined 3
4282  )
4283  ) {
4284  return 2;
4285  }
4286 
4287  return 0;
4288 }
4289 
4290 #endif
4291 
4296  [PM_ENCODING_UTF_8] = {
4297  .name = "UTF-8",
4298  .char_width = pm_encoding_utf_8_char_width,
4299  .alnum_char = pm_encoding_utf_8_alnum_char,
4300  .alpha_char = pm_encoding_utf_8_alpha_char,
4301  .isupper_char = pm_encoding_utf_8_isupper_char,
4302  .multibyte = true
4303  },
4304  [PM_ENCODING_US_ASCII] = {
4305  .name = "US-ASCII",
4306  .char_width = pm_encoding_ascii_char_width,
4307  .alnum_char = pm_encoding_ascii_alnum_char,
4308  .alpha_char = pm_encoding_ascii_alpha_char,
4309  .isupper_char = pm_encoding_ascii_isupper_char,
4310  .multibyte = false
4311  },
4312  [PM_ENCODING_ASCII_8BIT] = {
4313  .name = "ASCII-8BIT",
4314  .char_width = pm_encoding_single_char_width,
4315  .alnum_char = pm_encoding_ascii_alnum_char,
4316  .alpha_char = pm_encoding_ascii_alpha_char,
4317  .isupper_char = pm_encoding_ascii_isupper_char,
4318  .multibyte = false
4319  },
4320  [PM_ENCODING_EUC_JP] = {
4321  .name = "EUC-JP",
4322  .char_width = pm_encoding_euc_jp_char_width,
4323  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4324  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4325  .isupper_char = pm_encoding_euc_jp_isupper_char,
4326  .multibyte = true
4327  },
4328  [PM_ENCODING_WINDOWS_31J] = {
4329  .name = "Windows-31J",
4330  .char_width = pm_encoding_shift_jis_char_width,
4331  .alnum_char = pm_encoding_shift_jis_alnum_char,
4332  .alpha_char = pm_encoding_shift_jis_alpha_char,
4333  .isupper_char = pm_encoding_shift_jis_isupper_char,
4334  .multibyte = true
4335  },
4336 
4337 #ifndef PRISM_ENCODING_EXCLUDE_FULL
4338  [PM_ENCODING_BIG5] = {
4339  .name = "Big5",
4340  .char_width = pm_encoding_big5_char_width,
4341  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4342  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4343  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4344  .multibyte = true
4345  },
4346  [PM_ENCODING_BIG5_HKSCS] = {
4347  .name = "Big5-HKSCS",
4348  .char_width = pm_encoding_big5_char_width,
4349  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4350  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4351  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4352  .multibyte = true
4353  },
4354  [PM_ENCODING_BIG5_UAO] = {
4355  .name = "Big5-UAO",
4356  .char_width = pm_encoding_big5_char_width,
4357  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4358  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4359  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4360  .multibyte = true
4361  },
4362  [PM_ENCODING_CESU_8] = {
4363  .name = "CESU-8",
4364  .char_width = pm_encoding_cesu_8_char_width,
4365  .alnum_char = pm_encoding_cesu_8_alnum_char,
4366  .alpha_char = pm_encoding_cesu_8_alpha_char,
4367  .isupper_char = pm_encoding_cesu_8_isupper_char,
4368  .multibyte = true
4369  },
4370  [PM_ENCODING_CP51932] = {
4371  .name = "CP51932",
4372  .char_width = pm_encoding_euc_jp_char_width,
4373  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4374  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4375  .isupper_char = pm_encoding_euc_jp_isupper_char,
4376  .multibyte = true
4377  },
4378  [PM_ENCODING_CP850] = {
4379  .name = "CP850",
4380  .char_width = pm_encoding_single_char_width,
4381  .alnum_char = pm_encoding_cp850_alnum_char,
4382  .alpha_char = pm_encoding_cp850_alpha_char,
4383  .isupper_char = pm_encoding_cp850_isupper_char,
4384  .multibyte = false
4385  },
4386  [PM_ENCODING_CP852] = {
4387  .name = "CP852",
4388  .char_width = pm_encoding_single_char_width,
4389  .alnum_char = pm_encoding_cp852_alnum_char,
4390  .alpha_char = pm_encoding_cp852_alpha_char,
4391  .isupper_char = pm_encoding_cp852_isupper_char,
4392  .multibyte = false
4393  },
4394  [PM_ENCODING_CP855] = {
4395  .name = "CP855",
4396  .char_width = pm_encoding_single_char_width,
4397  .alnum_char = pm_encoding_cp855_alnum_char,
4398  .alpha_char = pm_encoding_cp855_alpha_char,
4399  .isupper_char = pm_encoding_cp855_isupper_char,
4400  .multibyte = false
4401  },
4402  [PM_ENCODING_CP949] = {
4403  .name = "CP949",
4404  .char_width = pm_encoding_cp949_char_width,
4405  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4406  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4407  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4408  .multibyte = true
4409  },
4410  [PM_ENCODING_CP950] = {
4411  .name = "CP950",
4412  .char_width = pm_encoding_big5_char_width,
4413  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4414  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4415  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4416  .multibyte = true
4417  },
4418  [PM_ENCODING_CP951] = {
4419  .name = "CP951",
4420  .char_width = pm_encoding_big5_char_width,
4421  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4422  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4423  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4424  .multibyte = true
4425  },
4426  [PM_ENCODING_EMACS_MULE] = {
4427  .name = "Emacs-Mule",
4428  .char_width = pm_encoding_emacs_mule_char_width,
4429  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4430  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4431  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4432  .multibyte = true
4433  },
4434  [PM_ENCODING_EUC_JP_MS] = {
4435  .name = "eucJP-ms",
4436  .char_width = pm_encoding_euc_jp_char_width,
4437  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4438  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4439  .isupper_char = pm_encoding_euc_jp_isupper_char,
4440  .multibyte = true
4441  },
4442  [PM_ENCODING_EUC_JIS_2004] = {
4443  .name = "EUC-JIS-2004",
4444  .char_width = pm_encoding_euc_jp_char_width,
4445  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4446  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4447  .isupper_char = pm_encoding_euc_jp_isupper_char,
4448  .multibyte = true
4449  },
4450  [PM_ENCODING_EUC_KR] = {
4451  .name = "EUC-KR",
4452  .char_width = pm_encoding_euc_kr_char_width,
4453  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4454  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4455  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4456  .multibyte = true
4457  },
4458  [PM_ENCODING_EUC_TW] = {
4459  .name = "EUC-TW",
4460  .char_width = pm_encoding_euc_tw_char_width,
4461  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4462  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4463  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4464  .multibyte = true
4465  },
4466  [PM_ENCODING_GB12345] = {
4467  .name = "GB12345",
4468  .char_width = pm_encoding_euc_kr_char_width,
4469  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4470  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4471  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4472  .multibyte = true
4473  },
4474  [PM_ENCODING_GB18030] = {
4475  .name = "GB18030",
4476  .char_width = pm_encoding_gb18030_char_width,
4477  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4478  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4479  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4480  .multibyte = true
4481  },
4482  [PM_ENCODING_GB1988] = {
4483  .name = "GB1988",
4484  .char_width = pm_encoding_single_char_width,
4485  .alnum_char = pm_encoding_gb1988_alnum_char,
4486  .alpha_char = pm_encoding_gb1988_alpha_char,
4487  .isupper_char = pm_encoding_gb1988_isupper_char,
4488  .multibyte = false
4489  },
4490  [PM_ENCODING_GB2312] = {
4491  .name = "GB2312",
4492  .char_width = pm_encoding_euc_kr_char_width,
4493  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4494  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4495  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4496  .multibyte = true
4497  },
4498  [PM_ENCODING_GBK] = {
4499  .name = "GBK",
4500  .char_width = pm_encoding_gbk_char_width,
4501  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4502  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4503  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4504  .multibyte = true
4505  },
4506  [PM_ENCODING_IBM437] = {
4507  .name = "IBM437",
4508  .char_width = pm_encoding_single_char_width,
4509  .alnum_char = pm_encoding_ibm437_alnum_char,
4510  .alpha_char = pm_encoding_ibm437_alpha_char,
4511  .isupper_char = pm_encoding_ibm437_isupper_char,
4512  .multibyte = false
4513  },
4514  [PM_ENCODING_IBM720] = {
4515  .name = "IBM720",
4516  .char_width = pm_encoding_single_char_width,
4517  .alnum_char = pm_encoding_ibm720_alnum_char,
4518  .alpha_char = pm_encoding_ibm720_alpha_char,
4519  .isupper_char = pm_encoding_ibm720_isupper_char,
4520  .multibyte = false
4521  },
4522  [PM_ENCODING_IBM737] = {
4523  .name = "IBM737",
4524  .char_width = pm_encoding_single_char_width,
4525  .alnum_char = pm_encoding_ibm737_alnum_char,
4526  .alpha_char = pm_encoding_ibm737_alpha_char,
4527  .isupper_char = pm_encoding_ibm737_isupper_char,
4528  .multibyte = false
4529  },
4530  [PM_ENCODING_IBM775] = {
4531  .name = "IBM775",
4532  .char_width = pm_encoding_single_char_width,
4533  .alnum_char = pm_encoding_ibm775_alnum_char,
4534  .alpha_char = pm_encoding_ibm775_alpha_char,
4535  .isupper_char = pm_encoding_ibm775_isupper_char,
4536  .multibyte = false
4537  },
4538  [PM_ENCODING_IBM852] = {
4539  .name = "IBM852",
4540  .char_width = pm_encoding_single_char_width,
4541  .alnum_char = pm_encoding_ibm852_alnum_char,
4542  .alpha_char = pm_encoding_ibm852_alpha_char,
4543  .isupper_char = pm_encoding_ibm852_isupper_char,
4544  .multibyte = false
4545  },
4546  [PM_ENCODING_IBM855] = {
4547  .name = "IBM855",
4548  .char_width = pm_encoding_single_char_width,
4549  .alnum_char = pm_encoding_ibm855_alnum_char,
4550  .alpha_char = pm_encoding_ibm855_alpha_char,
4551  .isupper_char = pm_encoding_ibm855_isupper_char,
4552  .multibyte = false
4553  },
4554  [PM_ENCODING_IBM857] = {
4555  .name = "IBM857",
4556  .char_width = pm_encoding_single_char_width,
4557  .alnum_char = pm_encoding_ibm857_alnum_char,
4558  .alpha_char = pm_encoding_ibm857_alpha_char,
4559  .isupper_char = pm_encoding_ibm857_isupper_char,
4560  .multibyte = false
4561  },
4562  [PM_ENCODING_IBM860] = {
4563  .name = "IBM860",
4564  .char_width = pm_encoding_single_char_width,
4565  .alnum_char = pm_encoding_ibm860_alnum_char,
4566  .alpha_char = pm_encoding_ibm860_alpha_char,
4567  .isupper_char = pm_encoding_ibm860_isupper_char,
4568  .multibyte = false
4569  },
4570  [PM_ENCODING_IBM861] = {
4571  .name = "IBM861",
4572  .char_width = pm_encoding_single_char_width,
4573  .alnum_char = pm_encoding_ibm861_alnum_char,
4574  .alpha_char = pm_encoding_ibm861_alpha_char,
4575  .isupper_char = pm_encoding_ibm861_isupper_char,
4576  .multibyte = false
4577  },
4578  [PM_ENCODING_IBM862] = {
4579  .name = "IBM862",
4580  .char_width = pm_encoding_single_char_width,
4581  .alnum_char = pm_encoding_ibm862_alnum_char,
4582  .alpha_char = pm_encoding_ibm862_alpha_char,
4583  .isupper_char = pm_encoding_ibm862_isupper_char,
4584  .multibyte = false
4585  },
4586  [PM_ENCODING_IBM863] = {
4587  .name = "IBM863",
4588  .char_width = pm_encoding_single_char_width,
4589  .alnum_char = pm_encoding_ibm863_alnum_char,
4590  .alpha_char = pm_encoding_ibm863_alpha_char,
4591  .isupper_char = pm_encoding_ibm863_isupper_char,
4592  .multibyte = false
4593  },
4594  [PM_ENCODING_IBM864] = {
4595  .name = "IBM864",
4596  .char_width = pm_encoding_single_char_width,
4597  .alnum_char = pm_encoding_ibm864_alnum_char,
4598  .alpha_char = pm_encoding_ibm864_alpha_char,
4599  .isupper_char = pm_encoding_ibm864_isupper_char,
4600  .multibyte = false
4601  },
4602  [PM_ENCODING_IBM865] = {
4603  .name = "IBM865",
4604  .char_width = pm_encoding_single_char_width,
4605  .alnum_char = pm_encoding_ibm865_alnum_char,
4606  .alpha_char = pm_encoding_ibm865_alpha_char,
4607  .isupper_char = pm_encoding_ibm865_isupper_char,
4608  .multibyte = false
4609  },
4610  [PM_ENCODING_IBM866] = {
4611  .name = "IBM866",
4612  .char_width = pm_encoding_single_char_width,
4613  .alnum_char = pm_encoding_ibm866_alnum_char,
4614  .alpha_char = pm_encoding_ibm866_alpha_char,
4615  .isupper_char = pm_encoding_ibm866_isupper_char,
4616  .multibyte = false
4617  },
4618  [PM_ENCODING_IBM869] = {
4619  .name = "IBM869",
4620  .char_width = pm_encoding_single_char_width,
4621  .alnum_char = pm_encoding_ibm869_alnum_char,
4622  .alpha_char = pm_encoding_ibm869_alpha_char,
4623  .isupper_char = pm_encoding_ibm869_isupper_char,
4624  .multibyte = false
4625  },
4626  [PM_ENCODING_ISO_8859_1] = {
4627  .name = "ISO-8859-1",
4628  .char_width = pm_encoding_single_char_width,
4629  .alnum_char = pm_encoding_iso_8859_1_alnum_char,
4630  .alpha_char = pm_encoding_iso_8859_1_alpha_char,
4631  .isupper_char = pm_encoding_iso_8859_1_isupper_char,
4632  .multibyte = false
4633  },
4634  [PM_ENCODING_ISO_8859_2] = {
4635  .name = "ISO-8859-2",
4636  .char_width = pm_encoding_single_char_width,
4637  .alnum_char = pm_encoding_iso_8859_2_alnum_char,
4638  .alpha_char = pm_encoding_iso_8859_2_alpha_char,
4639  .isupper_char = pm_encoding_iso_8859_2_isupper_char,
4640  .multibyte = false
4641  },
4642  [PM_ENCODING_ISO_8859_3] = {
4643  .name = "ISO-8859-3",
4644  .char_width = pm_encoding_single_char_width,
4645  .alnum_char = pm_encoding_iso_8859_3_alnum_char,
4646  .alpha_char = pm_encoding_iso_8859_3_alpha_char,
4647  .isupper_char = pm_encoding_iso_8859_3_isupper_char,
4648  .multibyte = false
4649  },
4650  [PM_ENCODING_ISO_8859_4] = {
4651  .name = "ISO-8859-4",
4652  .char_width = pm_encoding_single_char_width,
4653  .alnum_char = pm_encoding_iso_8859_4_alnum_char,
4654  .alpha_char = pm_encoding_iso_8859_4_alpha_char,
4655  .isupper_char = pm_encoding_iso_8859_4_isupper_char,
4656  .multibyte = false
4657  },
4658  [PM_ENCODING_ISO_8859_5] = {
4659  .name = "ISO-8859-5",
4660  .char_width = pm_encoding_single_char_width,
4661  .alnum_char = pm_encoding_iso_8859_5_alnum_char,
4662  .alpha_char = pm_encoding_iso_8859_5_alpha_char,
4663  .isupper_char = pm_encoding_iso_8859_5_isupper_char,
4664  .multibyte = false
4665  },
4666  [PM_ENCODING_ISO_8859_6] = {
4667  .name = "ISO-8859-6",
4668  .char_width = pm_encoding_single_char_width,
4669  .alnum_char = pm_encoding_iso_8859_6_alnum_char,
4670  .alpha_char = pm_encoding_iso_8859_6_alpha_char,
4671  .isupper_char = pm_encoding_iso_8859_6_isupper_char,
4672  .multibyte = false
4673  },
4674  [PM_ENCODING_ISO_8859_7] = {
4675  .name = "ISO-8859-7",
4676  .char_width = pm_encoding_single_char_width,
4677  .alnum_char = pm_encoding_iso_8859_7_alnum_char,
4678  .alpha_char = pm_encoding_iso_8859_7_alpha_char,
4679  .isupper_char = pm_encoding_iso_8859_7_isupper_char,
4680  .multibyte = false
4681  },
4682  [PM_ENCODING_ISO_8859_8] = {
4683  .name = "ISO-8859-8",
4684  .char_width = pm_encoding_single_char_width,
4685  .alnum_char = pm_encoding_iso_8859_8_alnum_char,
4686  .alpha_char = pm_encoding_iso_8859_8_alpha_char,
4687  .isupper_char = pm_encoding_iso_8859_8_isupper_char,
4688  .multibyte = false
4689  },
4690  [PM_ENCODING_ISO_8859_9] = {
4691  .name = "ISO-8859-9",
4692  .char_width = pm_encoding_single_char_width,
4693  .alnum_char = pm_encoding_iso_8859_9_alnum_char,
4694  .alpha_char = pm_encoding_iso_8859_9_alpha_char,
4695  .isupper_char = pm_encoding_iso_8859_9_isupper_char,
4696  .multibyte = false
4697  },
4698  [PM_ENCODING_ISO_8859_10] = {
4699  .name = "ISO-8859-10",
4700  .char_width = pm_encoding_single_char_width,
4701  .alnum_char = pm_encoding_iso_8859_10_alnum_char,
4702  .alpha_char = pm_encoding_iso_8859_10_alpha_char,
4703  .isupper_char = pm_encoding_iso_8859_10_isupper_char,
4704  .multibyte = false
4705  },
4706  [PM_ENCODING_ISO_8859_11] = {
4707  .name = "ISO-8859-11",
4708  .char_width = pm_encoding_single_char_width,
4709  .alnum_char = pm_encoding_iso_8859_11_alnum_char,
4710  .alpha_char = pm_encoding_iso_8859_11_alpha_char,
4711  .isupper_char = pm_encoding_iso_8859_11_isupper_char,
4712  .multibyte = false
4713  },
4714  [PM_ENCODING_ISO_8859_13] = {
4715  .name = "ISO-8859-13",
4716  .char_width = pm_encoding_single_char_width,
4717  .alnum_char = pm_encoding_iso_8859_13_alnum_char,
4718  .alpha_char = pm_encoding_iso_8859_13_alpha_char,
4719  .isupper_char = pm_encoding_iso_8859_13_isupper_char,
4720  .multibyte = false
4721  },
4722  [PM_ENCODING_ISO_8859_14] = {
4723  .name = "ISO-8859-14",
4724  .char_width = pm_encoding_single_char_width,
4725  .alnum_char = pm_encoding_iso_8859_14_alnum_char,
4726  .alpha_char = pm_encoding_iso_8859_14_alpha_char,
4727  .isupper_char = pm_encoding_iso_8859_14_isupper_char,
4728  .multibyte = false
4729  },
4730  [PM_ENCODING_ISO_8859_15] = {
4731  .name = "ISO-8859-15",
4732  .char_width = pm_encoding_single_char_width,
4733  .alnum_char = pm_encoding_iso_8859_15_alnum_char,
4734  .alpha_char = pm_encoding_iso_8859_15_alpha_char,
4735  .isupper_char = pm_encoding_iso_8859_15_isupper_char,
4736  .multibyte = false
4737  },
4738  [PM_ENCODING_ISO_8859_16] = {
4739  .name = "ISO-8859-16",
4740  .char_width = pm_encoding_single_char_width,
4741  .alnum_char = pm_encoding_iso_8859_16_alnum_char,
4742  .alpha_char = pm_encoding_iso_8859_16_alpha_char,
4743  .isupper_char = pm_encoding_iso_8859_16_isupper_char,
4744  .multibyte = false
4745  },
4746  [PM_ENCODING_KOI8_R] = {
4747  .name = "KOI8-R",
4748  .char_width = pm_encoding_single_char_width,
4749  .alnum_char = pm_encoding_koi8_r_alnum_char,
4750  .alpha_char = pm_encoding_koi8_r_alpha_char,
4751  .isupper_char = pm_encoding_koi8_r_isupper_char,
4752  .multibyte = false
4753  },
4754  [PM_ENCODING_KOI8_U] = {
4755  .name = "KOI8-U",
4756  .char_width = pm_encoding_single_char_width,
4757  .alnum_char = pm_encoding_koi8_u_alnum_char,
4758  .alpha_char = pm_encoding_koi8_u_alpha_char,
4759  .isupper_char = pm_encoding_koi8_u_isupper_char,
4760  .multibyte = false
4761  },
4762  [PM_ENCODING_MAC_CENT_EURO] = {
4763  .name = "macCentEuro",
4764  .char_width = pm_encoding_single_char_width,
4765  .alnum_char = pm_encoding_mac_cent_euro_alnum_char,
4766  .alpha_char = pm_encoding_mac_cent_euro_alpha_char,
4767  .isupper_char = pm_encoding_mac_cent_euro_isupper_char,
4768  .multibyte = false
4769  },
4770  [PM_ENCODING_MAC_CROATIAN] = {
4771  .name = "macCroatian",
4772  .char_width = pm_encoding_single_char_width,
4773  .alnum_char = pm_encoding_mac_croatian_alnum_char,
4774  .alpha_char = pm_encoding_mac_croatian_alpha_char,
4775  .isupper_char = pm_encoding_mac_croatian_isupper_char,
4776  .multibyte = false
4777  },
4778  [PM_ENCODING_MAC_CYRILLIC] = {
4779  .name = "macCyrillic",
4780  .char_width = pm_encoding_single_char_width,
4781  .alnum_char = pm_encoding_mac_cyrillic_alnum_char,
4782  .alpha_char = pm_encoding_mac_cyrillic_alpha_char,
4783  .isupper_char = pm_encoding_mac_cyrillic_isupper_char,
4784  .multibyte = false
4785  },
4786  [PM_ENCODING_MAC_GREEK] = {
4787  .name = "macGreek",
4788  .char_width = pm_encoding_single_char_width,
4789  .alnum_char = pm_encoding_mac_greek_alnum_char,
4790  .alpha_char = pm_encoding_mac_greek_alpha_char,
4791  .isupper_char = pm_encoding_mac_greek_isupper_char,
4792  .multibyte = false
4793  },
4794  [PM_ENCODING_MAC_ICELAND] = {
4795  .name = "macIceland",
4796  .char_width = pm_encoding_single_char_width,
4797  .alnum_char = pm_encoding_mac_iceland_alnum_char,
4798  .alpha_char = pm_encoding_mac_iceland_alpha_char,
4799  .isupper_char = pm_encoding_mac_iceland_isupper_char,
4800  .multibyte = false
4801  },
4802  [PM_ENCODING_MAC_JAPANESE] = {
4803  .name = "MacJapanese",
4804  .char_width = pm_encoding_shift_jis_char_width,
4805  .alnum_char = pm_encoding_shift_jis_alnum_char,
4806  .alpha_char = pm_encoding_shift_jis_alpha_char,
4807  .isupper_char = pm_encoding_shift_jis_isupper_char,
4808  .multibyte = true
4809  },
4810  [PM_ENCODING_MAC_ROMAN] = {
4811  .name = "macRoman",
4812  .char_width = pm_encoding_single_char_width,
4813  .alnum_char = pm_encoding_mac_roman_alnum_char,
4814  .alpha_char = pm_encoding_mac_roman_alpha_char,
4815  .isupper_char = pm_encoding_mac_roman_isupper_char,
4816  .multibyte = false
4817  },
4818  [PM_ENCODING_MAC_ROMANIA] = {
4819  .name = "macRomania",
4820  .char_width = pm_encoding_single_char_width,
4821  .alnum_char = pm_encoding_mac_romania_alnum_char,
4822  .alpha_char = pm_encoding_mac_romania_alpha_char,
4823  .isupper_char = pm_encoding_mac_romania_isupper_char,
4824  .multibyte = false
4825  },
4826  [PM_ENCODING_MAC_THAI] = {
4827  .name = "macThai",
4828  .char_width = pm_encoding_single_char_width,
4829  .alnum_char = pm_encoding_mac_thai_alnum_char,
4830  .alpha_char = pm_encoding_mac_thai_alpha_char,
4831  .isupper_char = pm_encoding_mac_thai_isupper_char,
4832  .multibyte = false
4833  },
4834  [PM_ENCODING_MAC_TURKISH] = {
4835  .name = "macTurkish",
4836  .char_width = pm_encoding_single_char_width,
4837  .alnum_char = pm_encoding_mac_turkish_alnum_char,
4838  .alpha_char = pm_encoding_mac_turkish_alpha_char,
4839  .isupper_char = pm_encoding_mac_turkish_isupper_char,
4840  .multibyte = false
4841  },
4842  [PM_ENCODING_MAC_UKRAINE] = {
4843  .name = "macUkraine",
4844  .char_width = pm_encoding_single_char_width,
4845  .alnum_char = pm_encoding_mac_ukraine_alnum_char,
4846  .alpha_char = pm_encoding_mac_ukraine_alpha_char,
4847  .isupper_char = pm_encoding_mac_ukraine_isupper_char,
4848  .multibyte = false
4849  },
4850  [PM_ENCODING_SHIFT_JIS] = {
4851  .name = "Shift_JIS",
4852  .char_width = pm_encoding_shift_jis_char_width,
4853  .alnum_char = pm_encoding_shift_jis_alnum_char,
4854  .alpha_char = pm_encoding_shift_jis_alpha_char,
4855  .isupper_char = pm_encoding_shift_jis_isupper_char,
4856  .multibyte = true
4857  },
4858  [PM_ENCODING_SJIS_DOCOMO] = {
4859  .name = "SJIS-DoCoMo",
4860  .char_width = pm_encoding_shift_jis_char_width,
4861  .alnum_char = pm_encoding_shift_jis_alnum_char,
4862  .alpha_char = pm_encoding_shift_jis_alpha_char,
4863  .isupper_char = pm_encoding_shift_jis_isupper_char,
4864  .multibyte = true
4865  },
4866  [PM_ENCODING_SJIS_KDDI] = {
4867  .name = "SJIS-KDDI",
4868  .char_width = pm_encoding_shift_jis_char_width,
4869  .alnum_char = pm_encoding_shift_jis_alnum_char,
4870  .alpha_char = pm_encoding_shift_jis_alpha_char,
4871  .isupper_char = pm_encoding_shift_jis_isupper_char,
4872  .multibyte = true
4873  },
4874  [PM_ENCODING_SJIS_SOFTBANK] = {
4875  .name = "SJIS-SoftBank",
4876  .char_width = pm_encoding_shift_jis_char_width,
4877  .alnum_char = pm_encoding_shift_jis_alnum_char,
4878  .alpha_char = pm_encoding_shift_jis_alpha_char,
4879  .isupper_char = pm_encoding_shift_jis_isupper_char,
4880  .multibyte = true
4881  },
4882  [PM_ENCODING_STATELESS_ISO_2022_JP] = {
4883  .name = "stateless-ISO-2022-JP",
4884  .char_width = pm_encoding_emacs_mule_char_width,
4885  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4886  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4887  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4888  .multibyte = true
4889  },
4890  [PM_ENCODING_STATELESS_ISO_2022_JP_KDDI] = {
4891  .name = "stateless-ISO-2022-JP-KDDI",
4892  .char_width = pm_encoding_emacs_mule_char_width,
4893  .alnum_char = pm_encoding_ascii_alnum_char_7bit,
4894  .alpha_char = pm_encoding_ascii_alpha_char_7bit,
4895  .isupper_char = pm_encoding_ascii_isupper_char_7bit,
4896  .multibyte = true
4897  },
4898  [PM_ENCODING_TIS_620] = {
4899  .name = "TIS-620",
4900  .char_width = pm_encoding_single_char_width,
4901  .alnum_char = pm_encoding_tis_620_alnum_char,
4902  .alpha_char = pm_encoding_tis_620_alpha_char,
4903  .isupper_char = pm_encoding_tis_620_isupper_char,
4904  .multibyte = false
4905  },
4906  [PM_ENCODING_UTF8_MAC] = {
4907  .name = "UTF8-MAC",
4908  .char_width = pm_encoding_utf_8_char_width,
4909  .alnum_char = pm_encoding_utf_8_alnum_char,
4910  .alpha_char = pm_encoding_utf_8_alpha_char,
4911  .isupper_char = pm_encoding_utf_8_isupper_char,
4912  .multibyte = true
4913  },
4914  [PM_ENCODING_UTF8_DOCOMO] = {
4915  .name = "UTF8-DoCoMo",
4916  .char_width = pm_encoding_utf_8_char_width,
4917  .alnum_char = pm_encoding_utf_8_alnum_char,
4918  .alpha_char = pm_encoding_utf_8_alpha_char,
4919  .isupper_char = pm_encoding_utf_8_isupper_char,
4920  .multibyte = true
4921  },
4922  [PM_ENCODING_UTF8_KDDI] = {
4923  .name = "UTF8-KDDI",
4924  .char_width = pm_encoding_utf_8_char_width,
4925  .alnum_char = pm_encoding_utf_8_alnum_char,
4926  .alpha_char = pm_encoding_utf_8_alpha_char,
4927  .isupper_char = pm_encoding_utf_8_isupper_char,
4928  .multibyte = true
4929  },
4930  [PM_ENCODING_UTF8_SOFTBANK] = {
4931  .name = "UTF8-SoftBank",
4932  .char_width = pm_encoding_utf_8_char_width,
4933  .alnum_char = pm_encoding_utf_8_alnum_char,
4934  .alpha_char = pm_encoding_utf_8_alpha_char,
4935  .isupper_char = pm_encoding_utf_8_isupper_char,
4936  .multibyte = true
4937  },
4938  [PM_ENCODING_WINDOWS_1250] = {
4939  .name = "Windows-1250",
4940  .char_width = pm_encoding_single_char_width,
4941  .alnum_char = pm_encoding_windows_1250_alnum_char,
4942  .alpha_char = pm_encoding_windows_1250_alpha_char,
4943  .isupper_char = pm_encoding_windows_1250_isupper_char,
4944  .multibyte = false
4945  },
4946  [PM_ENCODING_WINDOWS_1251] = {
4947  .name = "Windows-1251",
4948  .char_width = pm_encoding_single_char_width,
4949  .alnum_char = pm_encoding_windows_1251_alnum_char,
4950  .alpha_char = pm_encoding_windows_1251_alpha_char,
4951  .isupper_char = pm_encoding_windows_1251_isupper_char,
4952  .multibyte = false
4953  },
4954  [PM_ENCODING_WINDOWS_1252] = {
4955  .name = "Windows-1252",
4956  .char_width = pm_encoding_single_char_width,
4957  .alnum_char = pm_encoding_windows_1252_alnum_char,
4958  .alpha_char = pm_encoding_windows_1252_alpha_char,
4959  .isupper_char = pm_encoding_windows_1252_isupper_char,
4960  .multibyte = false
4961  },
4962  [PM_ENCODING_WINDOWS_1253] = {
4963  .name = "Windows-1253",
4964  .char_width = pm_encoding_single_char_width,
4965  .alnum_char = pm_encoding_windows_1253_alnum_char,
4966  .alpha_char = pm_encoding_windows_1253_alpha_char,
4967  .isupper_char = pm_encoding_windows_1253_isupper_char,
4968  .multibyte = false
4969  },
4970  [PM_ENCODING_WINDOWS_1254] = {
4971  .name = "Windows-1254",
4972  .char_width = pm_encoding_single_char_width,
4973  .alnum_char = pm_encoding_windows_1254_alnum_char,
4974  .alpha_char = pm_encoding_windows_1254_alpha_char,
4975  .isupper_char = pm_encoding_windows_1254_isupper_char,
4976  .multibyte = false
4977  },
4978  [PM_ENCODING_WINDOWS_1255] = {
4979  .name = "Windows-1255",
4980  .char_width = pm_encoding_single_char_width,
4981  .alnum_char = pm_encoding_windows_1255_alnum_char,
4982  .alpha_char = pm_encoding_windows_1255_alpha_char,
4983  .isupper_char = pm_encoding_windows_1255_isupper_char,
4984  .multibyte = false
4985  },
4986  [PM_ENCODING_WINDOWS_1256] = {
4987  .name = "Windows-1256",
4988  .char_width = pm_encoding_single_char_width,
4989  .alnum_char = pm_encoding_windows_1256_alnum_char,
4990  .alpha_char = pm_encoding_windows_1256_alpha_char,
4991  .isupper_char = pm_encoding_windows_1256_isupper_char,
4992  .multibyte = false
4993  },
4994  [PM_ENCODING_WINDOWS_1257] = {
4995  .name = "Windows-1257",
4996  .char_width = pm_encoding_single_char_width,
4997  .alnum_char = pm_encoding_windows_1257_alnum_char,
4998  .alpha_char = pm_encoding_windows_1257_alpha_char,
4999  .isupper_char = pm_encoding_windows_1257_isupper_char,
5000  .multibyte = false
5001  },
5002  [PM_ENCODING_WINDOWS_1258] = {
5003  .name = "Windows-1258",
5004  .char_width = pm_encoding_single_char_width,
5005  .alnum_char = pm_encoding_windows_1258_alnum_char,
5006  .alpha_char = pm_encoding_windows_1258_alpha_char,
5007  .isupper_char = pm_encoding_windows_1258_isupper_char,
5008  .multibyte = false
5009  },
5010  [PM_ENCODING_WINDOWS_874] = {
5011  .name = "Windows-874",
5012  .char_width = pm_encoding_single_char_width,
5013  .alnum_char = pm_encoding_windows_874_alnum_char,
5014  .alpha_char = pm_encoding_windows_874_alpha_char,
5015  .isupper_char = pm_encoding_windows_874_isupper_char,
5016  .multibyte = false
5017  }
5018 #endif
5019 };
5020 
5025 const pm_encoding_t *
5026 pm_encoding_find(const uint8_t *start, const uint8_t *end) {
5027  size_t width = (size_t) (end - start);
5028 
5029  // First, we're going to check for UTF-8. This is the most common encoding.
5030  // UTF-8 can contain extra information at the end about the platform it is
5031  // encoded on, such as UTF-8-MAC or UTF-8-UNIX. We'll ignore those suffixes.
5032  if ((start + 5 <= end) && (pm_strncasecmp(start, (const uint8_t *) "UTF-8", 5) == 0)) {
5033 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5034  // We need to explicitly handle UTF-8-HFS, as that one needs to switch
5035  // over to being UTF8-MAC.
5036  if (width == 9 && (pm_strncasecmp(start + 5, (const uint8_t *) "-HFS", 4) == 0)) {
5037  return &pm_encodings[PM_ENCODING_UTF8_MAC];
5038  }
5039 #endif
5040 
5041  // Otherwise we'll return the default UTF-8 encoding.
5042  return PM_ENCODING_UTF_8_ENTRY;
5043  }
5044 
5045  // Next, we're going to loop through each of the encodings that we handle
5046  // explicitly. If we found one that we understand, we'll use that value.
5047 #define ENCODING1(name, encoding) if (width == sizeof(name) - 1 && pm_strncasecmp(start, (const uint8_t *) name, width) == 0) return &pm_encodings[encoding];
5048 #define ENCODING2(name1, name2, encoding) ENCODING1(name1, encoding) ENCODING1(name2, encoding)
5049 
5050  if (width >= 3) {
5051  switch (*start) {
5052  case 'A': case 'a':
5053  ENCODING1("ASCII", PM_ENCODING_US_ASCII);
5054  ENCODING1("ASCII-8BIT", PM_ENCODING_ASCII_8BIT);
5055  ENCODING1("ANSI_X3.4-1968", PM_ENCODING_US_ASCII);
5056  break;
5057  case 'B': case 'b':
5058  ENCODING1("BINARY", PM_ENCODING_ASCII_8BIT);
5059 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5060  ENCODING1("Big5", PM_ENCODING_BIG5);
5061  ENCODING2("Big5-HKSCS", "Big5-HKSCS:2008", PM_ENCODING_BIG5_HKSCS);
5062  ENCODING1("Big5-UAO", PM_ENCODING_BIG5_UAO);
5063 #endif
5064  break;
5065  case 'C': case 'c':
5066  ENCODING1("CP65001", PM_ENCODING_UTF_8);
5067  ENCODING2("CP932", "csWindows31J", PM_ENCODING_WINDOWS_31J);
5068 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5069  ENCODING1("CESU-8", PM_ENCODING_CESU_8);
5070  ENCODING1("CP437", PM_ENCODING_IBM437);
5071  ENCODING1("CP720", PM_ENCODING_IBM720);
5072  ENCODING1("CP737", PM_ENCODING_IBM737);
5073  ENCODING1("CP775", PM_ENCODING_IBM775);
5074  ENCODING1("CP850", PM_ENCODING_CP850);
5075  ENCODING1("CP852", PM_ENCODING_CP852);
5076  ENCODING1("CP855", PM_ENCODING_CP855);
5077  ENCODING1("CP857", PM_ENCODING_IBM857);
5078  ENCODING1("CP860", PM_ENCODING_IBM860);
5079  ENCODING1("CP861", PM_ENCODING_IBM861);
5080  ENCODING1("CP862", PM_ENCODING_IBM862);
5081  ENCODING1("CP864", PM_ENCODING_IBM864);
5082  ENCODING1("CP865", PM_ENCODING_IBM865);
5083  ENCODING1("CP866", PM_ENCODING_IBM866);
5084  ENCODING1("CP869", PM_ENCODING_IBM869);
5085  ENCODING1("CP874", PM_ENCODING_WINDOWS_874);
5086  ENCODING1("CP878", PM_ENCODING_KOI8_R);
5087  ENCODING1("CP863", PM_ENCODING_IBM863);
5088  ENCODING1("CP936", PM_ENCODING_GBK);
5089  ENCODING1("CP949", PM_ENCODING_CP949);
5090  ENCODING1("CP950", PM_ENCODING_CP950);
5091  ENCODING1("CP951", PM_ENCODING_CP951);
5092  ENCODING1("CP1250", PM_ENCODING_WINDOWS_1250);
5093  ENCODING1("CP1251", PM_ENCODING_WINDOWS_1251);
5094  ENCODING1("CP1252", PM_ENCODING_WINDOWS_1252);
5095  ENCODING1("CP1253", PM_ENCODING_WINDOWS_1253);
5096  ENCODING1("CP1254", PM_ENCODING_WINDOWS_1254);
5097  ENCODING1("CP1255", PM_ENCODING_WINDOWS_1255);
5098  ENCODING1("CP1256", PM_ENCODING_WINDOWS_1256);
5099  ENCODING1("CP1257", PM_ENCODING_WINDOWS_1257);
5100  ENCODING1("CP1258", PM_ENCODING_WINDOWS_1258);
5101  ENCODING1("CP51932", PM_ENCODING_CP51932);
5102 #endif
5103  break;
5104  case 'E': case 'e':
5105  ENCODING2("EUC-JP", "eucJP", PM_ENCODING_EUC_JP);
5106 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5107  ENCODING2("eucJP-ms", "euc-jp-ms", PM_ENCODING_EUC_JP_MS);
5108  ENCODING2("EUC-JIS-2004", "EUC-JISX0213", PM_ENCODING_EUC_JIS_2004);
5109  ENCODING2("EUC-KR", "eucKR", PM_ENCODING_EUC_KR);
5110  ENCODING2("EUC-CN", "eucCN", PM_ENCODING_GB2312);
5111  ENCODING2("EUC-TW", "eucTW", PM_ENCODING_EUC_TW);
5112  ENCODING1("Emacs-Mule", PM_ENCODING_EMACS_MULE);
5113 #endif
5114  break;
5115  case 'G': case 'g':
5116 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5117  ENCODING1("GBK", PM_ENCODING_GBK);
5118  ENCODING1("GB12345", PM_ENCODING_GB12345);
5119  ENCODING1("GB18030", PM_ENCODING_GB18030);
5120  ENCODING1("GB1988", PM_ENCODING_GB1988);
5121  ENCODING1("GB2312", PM_ENCODING_GB2312);
5122 #endif
5123  break;
5124  case 'I': case 'i':
5125 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5126  ENCODING1("IBM437", PM_ENCODING_IBM437);
5127  ENCODING1("IBM720", PM_ENCODING_IBM720);
5128  ENCODING1("IBM737", PM_ENCODING_IBM737);
5129  ENCODING1("IBM775", PM_ENCODING_IBM775);
5130  ENCODING1("IBM850", PM_ENCODING_CP850);
5131  ENCODING1("IBM852", PM_ENCODING_IBM852);
5132  ENCODING1("IBM855", PM_ENCODING_IBM855);
5133  ENCODING1("IBM857", PM_ENCODING_IBM857);
5134  ENCODING1("IBM860", PM_ENCODING_IBM860);
5135  ENCODING1("IBM861", PM_ENCODING_IBM861);
5136  ENCODING1("IBM862", PM_ENCODING_IBM862);
5137  ENCODING1("IBM863", PM_ENCODING_IBM863);
5138  ENCODING1("IBM864", PM_ENCODING_IBM864);
5139  ENCODING1("IBM865", PM_ENCODING_IBM865);
5140  ENCODING1("IBM866", PM_ENCODING_IBM866);
5141  ENCODING1("IBM869", PM_ENCODING_IBM869);
5142  ENCODING2("ISO-8859-1", "ISO8859-1", PM_ENCODING_ISO_8859_1);
5143  ENCODING2("ISO-8859-2", "ISO8859-2", PM_ENCODING_ISO_8859_2);
5144  ENCODING2("ISO-8859-3", "ISO8859-3", PM_ENCODING_ISO_8859_3);
5145  ENCODING2("ISO-8859-4", "ISO8859-4", PM_ENCODING_ISO_8859_4);
5146  ENCODING2("ISO-8859-5", "ISO8859-5", PM_ENCODING_ISO_8859_5);
5147  ENCODING2("ISO-8859-6", "ISO8859-6", PM_ENCODING_ISO_8859_6);
5148  ENCODING2("ISO-8859-7", "ISO8859-7", PM_ENCODING_ISO_8859_7);
5149  ENCODING2("ISO-8859-8", "ISO8859-8", PM_ENCODING_ISO_8859_8);
5150  ENCODING2("ISO-8859-9", "ISO8859-9", PM_ENCODING_ISO_8859_9);
5151  ENCODING2("ISO-8859-10", "ISO8859-10", PM_ENCODING_ISO_8859_10);
5152  ENCODING2("ISO-8859-11", "ISO8859-11", PM_ENCODING_ISO_8859_11);
5153  ENCODING2("ISO-8859-13", "ISO8859-13", PM_ENCODING_ISO_8859_13);
5154  ENCODING2("ISO-8859-14", "ISO8859-14", PM_ENCODING_ISO_8859_14);
5155  ENCODING2("ISO-8859-15", "ISO8859-15", PM_ENCODING_ISO_8859_15);
5156  ENCODING2("ISO-8859-16", "ISO8859-16", PM_ENCODING_ISO_8859_16);
5157 #endif
5158  break;
5159  case 'K': case 'k':
5160 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5161  ENCODING1("KOI8-R", PM_ENCODING_KOI8_R);
5162  ENCODING1("KOI8-U", PM_ENCODING_KOI8_U);
5163 #endif
5164  break;
5165  case 'M': case 'm':
5166 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5167  ENCODING1("macCentEuro", PM_ENCODING_MAC_CENT_EURO);
5168  ENCODING1("macCroatian", PM_ENCODING_MAC_CROATIAN);
5169  ENCODING1("macCyrillic", PM_ENCODING_MAC_CYRILLIC);
5170  ENCODING1("macGreek", PM_ENCODING_MAC_GREEK);
5171  ENCODING1("macIceland", PM_ENCODING_MAC_ICELAND);
5172  ENCODING1("MacJapanese", PM_ENCODING_MAC_JAPANESE);
5173  ENCODING1("MacJapan", PM_ENCODING_MAC_JAPANESE);
5174  ENCODING1("macRoman", PM_ENCODING_MAC_ROMAN);
5175  ENCODING1("macRomania", PM_ENCODING_MAC_ROMANIA);
5176  ENCODING1("macThai", PM_ENCODING_MAC_THAI);
5177  ENCODING1("macTurkish", PM_ENCODING_MAC_TURKISH);
5178  ENCODING1("macUkraine", PM_ENCODING_MAC_UKRAINE);
5179 #endif
5180  break;
5181  case 'P': case 'p':
5182  ENCODING1("PCK", PM_ENCODING_WINDOWS_31J);
5183  break;
5184  case 'S': case 's':
5185  ENCODING1("SJIS", PM_ENCODING_WINDOWS_31J);
5186 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5187  ENCODING1("Shift_JIS", PM_ENCODING_SHIFT_JIS);
5188  ENCODING1("SJIS-DoCoMo", PM_ENCODING_SJIS_DOCOMO);
5189  ENCODING1("SJIS-KDDI", PM_ENCODING_SJIS_KDDI);
5190  ENCODING1("SJIS-SoftBank", PM_ENCODING_SJIS_SOFTBANK);
5191  ENCODING1("stateless-ISO-2022-JP", PM_ENCODING_STATELESS_ISO_2022_JP);
5192  ENCODING1("stateless-ISO-2022-JP-KDDI", PM_ENCODING_STATELESS_ISO_2022_JP_KDDI);
5193 #endif
5194  break;
5195  case 'T': case 't':
5196 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5197  ENCODING1("TIS-620", PM_ENCODING_TIS_620);
5198 #endif
5199  break;
5200  case 'U': case 'u':
5201  ENCODING1("US-ASCII", PM_ENCODING_US_ASCII);
5202 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5203  ENCODING2("UTF8-MAC", "UTF-8-HFS", PM_ENCODING_UTF8_MAC);
5204  ENCODING1("UTF8-DoCoMo", PM_ENCODING_UTF8_DOCOMO);
5205  ENCODING1("UTF8-KDDI", PM_ENCODING_UTF8_KDDI);
5206  ENCODING1("UTF8-SoftBank", PM_ENCODING_UTF8_SOFTBANK);
5207 #endif
5208  break;
5209  case 'W': case 'w':
5210  ENCODING1("Windows-31J", PM_ENCODING_WINDOWS_31J);
5211 #ifndef PRISM_ENCODING_EXCLUDE_FULL
5212  ENCODING1("Windows-874", PM_ENCODING_WINDOWS_874);
5213  ENCODING1("Windows-1250", PM_ENCODING_WINDOWS_1250);
5214  ENCODING1("Windows-1251", PM_ENCODING_WINDOWS_1251);
5215  ENCODING1("Windows-1252", PM_ENCODING_WINDOWS_1252);
5216  ENCODING1("Windows-1253", PM_ENCODING_WINDOWS_1253);
5217  ENCODING1("Windows-1254", PM_ENCODING_WINDOWS_1254);
5218  ENCODING1("Windows-1255", PM_ENCODING_WINDOWS_1255);
5219  ENCODING1("Windows-1256", PM_ENCODING_WINDOWS_1256);
5220  ENCODING1("Windows-1257", PM_ENCODING_WINDOWS_1257);
5221  ENCODING1("Windows-1258", PM_ENCODING_WINDOWS_1258);
5222 #endif
5223  break;
5224  case '6':
5225  ENCODING1("646", PM_ENCODING_US_ASCII);
5226  break;
5227  }
5228  }
5229 
5230 #undef ENCODING2
5231 #undef ENCODING1
5232 
5233  // If we didn't match any encodings, return NULL.
5234  return NULL;
5235 }
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition: cxxanyargs.hpp:56
int pm_strncasecmp(const uint8_t *string1, const uint8_t *string2, size_t length)
Compare two strings, ignoring case, up to the given length.
#define PRISM_ATTRIBUTE_UNUSED
GCC will warn if you specify a function or parameter that is unused at runtime.
Definition: defines.h:78
The encoding interface and implementations used by the parser.
#define PRISM_ENCODING_UPPERCASE_BIT
All of the lookup tables use the third bit of each embedded byte to indicate whether the codepoint is...
Definition: encoding.h:80
bool pm_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n)
Return true if the next character in the UTF-8 encoding if it is an uppercase character.
Definition: encoding.c:2346
#define PM_ENCODING_UTF_8_ENTRY
This is the default UTF-8 encoding.
Definition: encoding.h:245
#define PRISM_ENCODING_ALPHABETIC_BIT
All of the lookup tables use the first bit of each embedded byte to indicate whether the codepoint is...
Definition: encoding.h:68
const pm_encoding_t pm_encodings[PM_ENCODING_MAXIMUM]
This is the table of all of the encodings that prism supports.
Definition: encoding.c:4295
const uint8_t pm_encoding_unicode_table[256]
This lookup table is referenced in both the UTF-8 encoding file and the parser directly in order to s...
Definition: encoding.c:2164
size_t pm_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n)
Return the size of the next character in the UTF-8 encoding if it is an alphabetical character.
Definition: encoding.c:2306
const pm_encoding_t * pm_encoding_find(const uint8_t *start, const uint8_t *end)
Parse the given name of an encoding and return a pointer to the corresponding encoding struct if one ...
Definition: encoding.c:5026
size_t pm_encoding_utf_8_char_width(const uint8_t *b, ptrdiff_t n)
Return the size of the next character in the UTF-8 encoding.
Definition: encoding.c:2287
#define PRISM_ENCODING_ALPHANUMERIC_BIT
All of the lookup tables use the second bit of each embedded byte to indicate whether the codepoint i...
Definition: encoding.h:74
size_t pm_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n)
Return the size of the next character in the UTF-8 encoding if it is an alphanumeric character.
Definition: encoding.c:2326
This struct defines the functions necessary to implement the encoding interface so we can determine h...
Definition: encoding.h:23
const char * name
The name of the encoding.
Definition: encoding.h:56