charcode 0.1.5

Character encoding conversion implementing the WHATWG Encoding Standard, with no external dependencies.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
// @generated by tools/generate_tables.py from the WHATWG Encoding Standard indexes.
// https://encoding.spec.whatwg.org/indexes.json
// Do not edit by hand; re-run the generator instead.

//! The [`Encoding`] instances for the charsets outside the standard.

use crate::Encoding;
// A build may take only the charsets that need no table.
#[cfg(any(
    feature = "dos",
    feature = "ebcdic",
    feature = "mac",
    feature = "misc",
    feature = "single-byte"
))]
#[allow(unused_imports)]
use crate::tables::extra as t;
use crate::variant::VariantEncoding;

// IBM PC / OEM code pages

#[cfg(feature = "dos")]
pub(crate) const IBM437_INIT: Encoding = Encoding::new(
    "IBM437",
    VariantEncoding::SingleByte(
        &t::IBM437_DECODE,
        &t::IBM437_ENCODE_CODE_POINTS,
        &t::IBM437_ENCODE_BYTES,
    ),
);
/// IBM437
#[cfg(feature = "dos")]
pub static IBM437: &Encoding = &IBM437_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM737_INIT: Encoding = Encoding::new(
    "IBM737",
    VariantEncoding::SingleByte(
        &t::IBM737_DECODE,
        &t::IBM737_ENCODE_CODE_POINTS,
        &t::IBM737_ENCODE_BYTES,
    ),
);
/// IBM737
#[cfg(feature = "dos")]
pub static IBM737: &Encoding = &IBM737_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM775_INIT: Encoding = Encoding::new(
    "IBM775",
    VariantEncoding::SingleByte(
        &t::IBM775_DECODE,
        &t::IBM775_ENCODE_CODE_POINTS,
        &t::IBM775_ENCODE_BYTES,
    ),
);
/// IBM775
#[cfg(feature = "dos")]
pub static IBM775: &Encoding = &IBM775_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM850_INIT: Encoding = Encoding::new(
    "IBM850",
    VariantEncoding::SingleByte(
        &t::IBM850_DECODE,
        &t::IBM850_ENCODE_CODE_POINTS,
        &t::IBM850_ENCODE_BYTES,
    ),
);
/// IBM850
#[cfg(feature = "dos")]
pub static IBM850: &Encoding = &IBM850_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM852_INIT: Encoding = Encoding::new(
    "IBM852",
    VariantEncoding::SingleByte(
        &t::IBM852_DECODE,
        &t::IBM852_ENCODE_CODE_POINTS,
        &t::IBM852_ENCODE_BYTES,
    ),
);
/// IBM852
#[cfg(feature = "dos")]
pub static IBM852: &Encoding = &IBM852_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM855_INIT: Encoding = Encoding::new(
    "IBM855",
    VariantEncoding::SingleByte(
        &t::IBM855_DECODE,
        &t::IBM855_ENCODE_CODE_POINTS,
        &t::IBM855_ENCODE_BYTES,
    ),
);
/// IBM855
#[cfg(feature = "dos")]
pub static IBM855: &Encoding = &IBM855_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM856_INIT: Encoding = Encoding::new(
    "IBM856",
    VariantEncoding::SingleByte(
        &t::IBM856_DECODE,
        &t::IBM856_ENCODE_CODE_POINTS,
        &t::IBM856_ENCODE_BYTES,
    ),
);
/// IBM856
#[cfg(feature = "dos")]
pub static IBM856: &Encoding = &IBM856_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM857_INIT: Encoding = Encoding::new(
    "IBM857",
    VariantEncoding::SingleByte(
        &t::IBM857_DECODE,
        &t::IBM857_ENCODE_CODE_POINTS,
        &t::IBM857_ENCODE_BYTES,
    ),
);
/// IBM857
#[cfg(feature = "dos")]
pub static IBM857: &Encoding = &IBM857_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM860_INIT: Encoding = Encoding::new(
    "IBM860",
    VariantEncoding::SingleByte(
        &t::IBM860_DECODE,
        &t::IBM860_ENCODE_CODE_POINTS,
        &t::IBM860_ENCODE_BYTES,
    ),
);
/// IBM860
#[cfg(feature = "dos")]
pub static IBM860: &Encoding = &IBM860_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM861_INIT: Encoding = Encoding::new(
    "IBM861",
    VariantEncoding::SingleByte(
        &t::IBM861_DECODE,
        &t::IBM861_ENCODE_CODE_POINTS,
        &t::IBM861_ENCODE_BYTES,
    ),
);
/// IBM861
#[cfg(feature = "dos")]
pub static IBM861: &Encoding = &IBM861_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM862_INIT: Encoding = Encoding::new(
    "IBM862",
    VariantEncoding::SingleByte(
        &t::IBM862_DECODE,
        &t::IBM862_ENCODE_CODE_POINTS,
        &t::IBM862_ENCODE_BYTES,
    ),
);
/// IBM862
#[cfg(feature = "dos")]
pub static IBM862: &Encoding = &IBM862_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM863_INIT: Encoding = Encoding::new(
    "IBM863",
    VariantEncoding::SingleByte(
        &t::IBM863_DECODE,
        &t::IBM863_ENCODE_CODE_POINTS,
        &t::IBM863_ENCODE_BYTES,
    ),
);
/// IBM863
#[cfg(feature = "dos")]
pub static IBM863: &Encoding = &IBM863_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM864_INIT: Encoding = Encoding::new(
    "IBM864",
    VariantEncoding::FullByte(
        &t::IBM864_DECODE,
        &t::IBM864_ENCODE_CODE_POINTS,
        &t::IBM864_ENCODE_BYTES,
    ),
);
/// IBM864
#[cfg(feature = "dos")]
pub static IBM864: &Encoding = &IBM864_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM865_INIT: Encoding = Encoding::new(
    "IBM865",
    VariantEncoding::SingleByte(
        &t::IBM865_DECODE,
        &t::IBM865_ENCODE_CODE_POINTS,
        &t::IBM865_ENCODE_BYTES,
    ),
);
/// IBM865
#[cfg(feature = "dos")]
pub static IBM865: &Encoding = &IBM865_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM869_INIT: Encoding = Encoding::new(
    "IBM869",
    VariantEncoding::SingleByte(
        &t::IBM869_DECODE,
        &t::IBM869_ENCODE_CODE_POINTS,
        &t::IBM869_ENCODE_BYTES,
    ),
);
/// IBM869
#[cfg(feature = "dos")]
pub static IBM869: &Encoding = &IBM869_INIT;

#[cfg(feature = "dos")]
pub(crate) const IBM1006_INIT: Encoding = Encoding::new(
    "IBM1006",
    VariantEncoding::SingleByte(
        &t::IBM1006_DECODE,
        &t::IBM1006_ENCODE_CODE_POINTS,
        &t::IBM1006_ENCODE_BYTES,
    ),
);
/// IBM1006
#[cfg(feature = "dos")]
pub static IBM1006: &Encoding = &IBM1006_INIT;

// IBM mainframe EBCDIC code pages

#[cfg(feature = "ebcdic")]
pub(crate) const IBM037_INIT: Encoding = Encoding::new(
    "IBM037",
    VariantEncoding::FullByte(
        &t::IBM037_DECODE,
        &t::IBM037_ENCODE_CODE_POINTS,
        &t::IBM037_ENCODE_BYTES,
    ),
);
/// IBM037
#[cfg(feature = "ebcdic")]
pub static IBM037: &Encoding = &IBM037_INIT;

#[cfg(feature = "ebcdic")]
pub(crate) const IBM424_INIT: Encoding = Encoding::new(
    "IBM424",
    VariantEncoding::FullByte(
        &t::IBM424_DECODE,
        &t::IBM424_ENCODE_CODE_POINTS,
        &t::IBM424_ENCODE_BYTES,
    ),
);
/// IBM424
#[cfg(feature = "ebcdic")]
pub static IBM424: &Encoding = &IBM424_INIT;

#[cfg(feature = "ebcdic")]
pub(crate) const IBM500_INIT: Encoding = Encoding::new(
    "IBM500",
    VariantEncoding::FullByte(
        &t::IBM500_DECODE,
        &t::IBM500_ENCODE_CODE_POINTS,
        &t::IBM500_ENCODE_BYTES,
    ),
);
/// IBM500
#[cfg(feature = "ebcdic")]
pub static IBM500: &Encoding = &IBM500_INIT;

#[cfg(feature = "ebcdic")]
pub(crate) const IBM875_INIT: Encoding = Encoding::new(
    "IBM875",
    VariantEncoding::FullByte(
        &t::IBM875_DECODE,
        &t::IBM875_ENCODE_CODE_POINTS,
        &t::IBM875_ENCODE_BYTES,
    ),
);
/// IBM875
#[cfg(feature = "ebcdic")]
pub static IBM875: &Encoding = &IBM875_INIT;

#[cfg(feature = "ebcdic")]
pub(crate) const IBM1026_INIT: Encoding = Encoding::new(
    "IBM1026",
    VariantEncoding::FullByte(
        &t::IBM1026_DECODE,
        &t::IBM1026_ENCODE_CODE_POINTS,
        &t::IBM1026_ENCODE_BYTES,
    ),
);
/// IBM1026
#[cfg(feature = "ebcdic")]
pub static IBM1026: &Encoding = &IBM1026_INIT;

// Apple's regional variants of Mac OS Roman

#[cfg(feature = "mac")]
pub(crate) const X_MAC_ARABIC_INIT: Encoding = Encoding::new(
    "x-mac-arabic",
    VariantEncoding::SingleByte(
        &t::X_MAC_ARABIC_DECODE,
        &t::X_MAC_ARABIC_ENCODE_CODE_POINTS,
        &t::X_MAC_ARABIC_ENCODE_BYTES,
    ),
);
/// x-mac-arabic
#[cfg(feature = "mac")]
pub static X_MAC_ARABIC: &Encoding = &X_MAC_ARABIC_INIT;

#[cfg(feature = "mac")]
pub(crate) const X_MAC_CELTIC_INIT: Encoding = Encoding::new(
    "x-mac-celtic",
    VariantEncoding::SingleByte(
        &t::X_MAC_CELTIC_DECODE,
        &t::X_MAC_CELTIC_ENCODE_CODE_POINTS,
        &t::X_MAC_CELTIC_ENCODE_BYTES,
    ),
);
/// x-mac-celtic
#[cfg(feature = "mac")]
pub static X_MAC_CELTIC: &Encoding = &X_MAC_CELTIC_INIT;

#[cfg(feature = "mac")]
pub(crate) const X_MAC_CENTRALEURROMAN_INIT: Encoding = Encoding::new(
    "x-mac-centraleurroman",
    VariantEncoding::SingleByte(
        &t::X_MAC_CENTRALEURROMAN_DECODE,
        &t::X_MAC_CENTRALEURROMAN_ENCODE_CODE_POINTS,
        &t::X_MAC_CENTRALEURROMAN_ENCODE_BYTES,
    ),
);
/// x-mac-centraleurroman
#[cfg(feature = "mac")]
pub static X_MAC_CENTRALEURROMAN: &Encoding = &X_MAC_CENTRALEURROMAN_INIT;

#[cfg(feature = "mac")]
pub(crate) const X_MAC_CROATIAN_INIT: Encoding = Encoding::new(
    "x-mac-croatian",
    VariantEncoding::SingleByte(
        &t::X_MAC_CROATIAN_DECODE,
        &t::X_MAC_CROATIAN_ENCODE_CODE_POINTS,
        &t::X_MAC_CROATIAN_ENCODE_BYTES,
    ),
);
/// x-mac-croatian
#[cfg(feature = "mac")]
pub static X_MAC_CROATIAN: &Encoding = &X_MAC_CROATIAN_INIT;

#[cfg(feature = "mac")]
pub(crate) const X_MAC_FARSI_INIT: Encoding = Encoding::new(
    "x-mac-farsi",
    VariantEncoding::SingleByte(
        &t::X_MAC_FARSI_DECODE,
        &t::X_MAC_FARSI_ENCODE_CODE_POINTS,
        &t::X_MAC_FARSI_ENCODE_BYTES,
    ),
);
/// x-mac-farsi
#[cfg(feature = "mac")]
pub static X_MAC_FARSI: &Encoding = &X_MAC_FARSI_INIT;

#[cfg(feature = "mac")]
pub(crate) const X_MAC_GAELIC_INIT: Encoding = Encoding::new(
    "x-mac-gaelic",
    VariantEncoding::SingleByte(
        &t::X_MAC_GAELIC_DECODE,
        &t::X_MAC_GAELIC_ENCODE_CODE_POINTS,
        &t::X_MAC_GAELIC_ENCODE_BYTES,
    ),
);
/// x-mac-gaelic
#[cfg(feature = "mac")]
pub static X_MAC_GAELIC: &Encoding = &X_MAC_GAELIC_INIT;

#[cfg(feature = "mac")]
pub(crate) const X_MAC_GREEK_INIT: Encoding = Encoding::new(
    "x-mac-greek",
    VariantEncoding::SingleByte(
        &t::X_MAC_GREEK_DECODE,
        &t::X_MAC_GREEK_ENCODE_CODE_POINTS,
        &t::X_MAC_GREEK_ENCODE_BYTES,
    ),
);
/// x-mac-greek
#[cfg(feature = "mac")]
pub static X_MAC_GREEK: &Encoding = &X_MAC_GREEK_INIT;

#[cfg(feature = "mac")]
pub(crate) const X_MAC_ICELANDIC_INIT: Encoding = Encoding::new(
    "x-mac-icelandic",
    VariantEncoding::SingleByte(
        &t::X_MAC_ICELANDIC_DECODE,
        &t::X_MAC_ICELANDIC_ENCODE_CODE_POINTS,
        &t::X_MAC_ICELANDIC_ENCODE_BYTES,
    ),
);
/// x-mac-icelandic
#[cfg(feature = "mac")]
pub static X_MAC_ICELANDIC: &Encoding = &X_MAC_ICELANDIC_INIT;

#[cfg(feature = "mac")]
pub(crate) const X_MAC_ROMANIAN_INIT: Encoding = Encoding::new(
    "x-mac-romanian",
    VariantEncoding::SingleByte(
        &t::X_MAC_ROMANIAN_DECODE,
        &t::X_MAC_ROMANIAN_ENCODE_CODE_POINTS,
        &t::X_MAC_ROMANIAN_ENCODE_BYTES,
    ),
);
/// x-mac-romanian
#[cfg(feature = "mac")]
pub static X_MAC_ROMANIAN: &Encoding = &X_MAC_ROMANIAN_INIT;

#[cfg(feature = "mac")]
pub(crate) const X_MAC_TURKISH_INIT: Encoding = Encoding::new(
    "x-mac-turkish",
    VariantEncoding::SingleByte(
        &t::X_MAC_TURKISH_DECODE,
        &t::X_MAC_TURKISH_ENCODE_CODE_POINTS,
        &t::X_MAC_TURKISH_ENCODE_BYTES,
    ),
);
/// x-mac-turkish
#[cfg(feature = "mac")]
pub static X_MAC_TURKISH: &Encoding = &X_MAC_TURKISH_INIT;

// Everything else

#[cfg(feature = "misc")]
pub(crate) const ATARI_ST_INIT: Encoding = Encoding::new(
    "Atari-ST",
    VariantEncoding::SingleByte(
        &t::ATARI_ST_DECODE,
        &t::ATARI_ST_ENCODE_CODE_POINTS,
        &t::ATARI_ST_ENCODE_BYTES,
    ),
);
/// Atari-ST
#[cfg(feature = "misc")]
pub static ATARI_ST: &Encoding = &ATARI_ST_INIT;

#[cfg(feature = "misc")]
pub(crate) const KZ_1048_INIT: Encoding = Encoding::new(
    "KZ-1048",
    VariantEncoding::SingleByte(
        &t::KZ_1048_DECODE,
        &t::KZ_1048_ENCODE_CODE_POINTS,
        &t::KZ_1048_ENCODE_BYTES,
    ),
);
/// KZ-1048
#[cfg(feature = "misc")]
pub static KZ_1048: &Encoding = &KZ_1048_INIT;

// ISO 8859 parts the standard resolves elsewhere

#[cfg(feature = "single-byte")]
pub(crate) const ISO_8859_9_INIT: Encoding = Encoding::new(
    "ISO-8859-9",
    VariantEncoding::SingleByte(
        &t::ISO_8859_9_DECODE,
        &t::ISO_8859_9_ENCODE_CODE_POINTS,
        &t::ISO_8859_9_ENCODE_BYTES,
    ),
);
/// ISO-8859-9
#[cfg(feature = "single-byte")]
pub static ISO_8859_9: &Encoding = &ISO_8859_9_INIT;

#[cfg(feature = "single-byte")]
pub(crate) const ISO_8859_11_INIT: Encoding = Encoding::new(
    "ISO-8859-11",
    VariantEncoding::SingleByte(
        &t::ISO_8859_11_DECODE,
        &t::ISO_8859_11_ENCODE_CODE_POINTS,
        &t::ISO_8859_11_ENCODE_BYTES,
    ),
);
/// ISO-8859-11
#[cfg(feature = "single-byte")]
pub static ISO_8859_11: &Encoding = &ISO_8859_11_INIT;

// Algorithmic charsets, which need no table

pub(crate) const ISO_8859_1_INIT: Encoding = Encoding::new(
    "ISO-8859-1",
    VariantEncoding::Identity(crate::identity::Identity::latin1()),
);
/// ISO-8859-1
pub static ISO_8859_1: &Encoding = &ISO_8859_1_INIT;

pub(crate) const US_ASCII_INIT: Encoding = Encoding::new(
    "US-ASCII",
    VariantEncoding::Identity(crate::identity::Identity::ascii()),
);
/// US-ASCII
pub static US_ASCII: &Encoding = &US_ASCII_INIT;

#[cfg(feature = "gb18030")]
pub(crate) const GB2312_INIT: Encoding = Encoding::new("GB2312", VariantEncoding::Gb2312);
/// GB 2312-80, in its EUC-CN form.
///
/// Not the standard's `gb2312` label, which resolves to GBK: a superset, but
/// one that gives two of GB 2312's code points a different character.
#[cfg(feature = "gb18030")]
pub static GB2312: &Encoding = &GB2312_INIT;

#[cfg(feature = "big5")]
pub(crate) const BIG5_INIT: Encoding = Encoding::new("Big5", VariantEncoding::Big5_1984);
/// Big5, as the Unicode Consortium maps it in `BIG5.TXT`.
///
/// Not the standard's index of the same name, which is Big5 plus the Hong Kong
/// Supplementary Character Set and gives 260 of Big5's own pointers a different
/// character; that one is [`BIG5_HKSCS`](crate::BIG5_HKSCS).  Big5 has no single
/// official Unicode mapping, and at eleven punctuation cells this follows the
/// Unicode Consortium rather than Microsoft's code page 950 — 0xA1E3 is U+223C
/// TILDE OPERATOR here and U+FF5E in Microsoft's table, and so on.
#[cfg(feature = "big5")]
pub static BIG5: &Encoding = &BIG5_INIT;

#[cfg(feature = "shift-jis")]
pub(crate) const SHIFT_JIS_INIT: Encoding =
    Encoding::new("Shift_JIS", VariantEncoding::ShiftJis1997);
/// Shift_JIS, as JIS X 0208:1997 Annex 1 defines it.
///
/// JIS X 0201's Roman set below 0x80 and JIS X 0208 above it, and nothing
/// else.  The standard's encoding of the same name is Windows codepage 932;
/// that one is [`WINDOWS_31J`](crate::WINDOWS_31J).  They disagree most
/// visibly at 0x5C, which is U+00A5 YEN SIGN here and the backslash there.
#[cfg(feature = "shift-jis")]
pub static SHIFT_JIS: &Encoding = &SHIFT_JIS_INIT;

#[cfg(feature = "euc-jp")]
pub(crate) const EUC_JP_INIT: Encoding = Encoding::new("EUC-JP", VariantEncoding::EucJp1997);
/// EUC-JP: ASCII, JIS X 0201's katakana, JIS X 0208 and JIS X 0212.
///
/// The standard's encoding of the same name folds the NEC and IBM extension
/// rows into the JIS X 0208 plane and remaps six of its pointers, and never
/// writes the JIS X 0212 plane; that one is
/// [`X_WHATWG_EUC_JP`](crate::X_WHATWG_EUC_JP).
#[cfg(feature = "euc-jp")]
pub static EUC_JP: &Encoding = &EUC_JP_INIT;

#[cfg(feature = "iso-2022-jp")]
pub(crate) const ISO_2022_JP_INIT: Encoding =
    Encoding::new("ISO-2022-JP", VariantEncoding::Iso2022Jp1468);
/// ISO-2022-JP, as RFC 1468 defines it: ASCII, JIS X 0201's Roman set and JIS X 0208.
///
/// The standard's encoding of the same name adds a half-width katakana mode
/// behind `ESC ( I`, folds the NEC and IBM extension rows into the JIS X 0208
/// plane and remaps six of its pointers; that one is
/// [`X_WHATWG_ISO_2022_JP`](crate::X_WHATWG_ISO_2022_JP).
#[cfg(feature = "iso-2022-jp")]
pub static ISO_2022_JP: &Encoding = &ISO_2022_JP_INIT;

#[cfg(feature = "iso-2022-kr")]
pub(crate) const ISO_2022_KR_INIT: Encoding =
    Encoding::new("ISO-2022-KR", VariantEncoding::Iso2022Kr);
/// ISO-2022-KR (RFC 1557), which shifts between ASCII and KS X 1001.
#[cfg(feature = "iso-2022-kr")]
pub static ISO_2022_KR: &Encoding = &ISO_2022_KR_INIT;

#[cfg(feature = "iso-2022-cn")]
pub(crate) const ISO_2022_CN_INIT: Encoding =
    Encoding::new("ISO-2022-CN", VariantEncoding::Iso2022Cn);
/// ISO-2022-CN (RFC 1922): ASCII, GB 2312 and CNS 11643 planes 1 and 2.
///
/// Not ISO-2022-CN-EXT, whose ISO-IR-165 and CNS 11643 planes 3 to 7 have no
/// authoritative published mapping; its designators are errors here.
#[cfg(feature = "iso-2022-cn")]
pub static ISO_2022_CN: &Encoding = &ISO_2022_CN_INIT;

#[cfg(feature = "iso-2022-jp-2")]
pub(crate) const ISO_2022_JP_2_INIT: Encoding =
    Encoding::new("ISO-2022-JP-2", VariantEncoding::Iso2022Jp2);
/// ISO-2022-JP-2 (RFC 1554), which designates six sets rather than three.
///
/// ISO-2022-JP plus GB 2312-80, KS X 1001, JIS X 0212 and the right halves of
/// ISO 8859-1 and ISO 8859-7, which is what lets a 7-bit mail transport carry
/// Latin, Greek, Japanese, Chinese and Korean in one message.
#[cfg(feature = "iso-2022-jp-2")]
pub static ISO_2022_JP_2: &Encoding = &ISO_2022_JP_2_INIT;

#[cfg(feature = "scsu")]
pub(crate) const SCSU_INIT: Encoding = Encoding::new("SCSU", VariantEncoding::Scsu);
/// The Standard Compression Scheme for Unicode (UTS #6).
///
/// Not a charset but a compression scheme, which expresses all of Unicode at
/// about the size a single-byte encoding would take.  It needs no table: eight
/// 128-character windows move over Unicode instead, and tag bytes shift
/// between them or drop into big-endian UTF-16.
#[cfg(feature = "scsu")]
pub static SCSU: &Encoding = &SCSU_INIT;

#[cfg(feature = "unicode-extras")]
pub(crate) const UTF_32BE_INIT: Encoding = Encoding::new("UTF-32BE", VariantEncoding::Utf32Be);
/// UTF-32BE
#[cfg(feature = "unicode-extras")]
pub static UTF_32BE: &Encoding = &UTF_32BE_INIT;

#[cfg(feature = "unicode-extras")]
pub(crate) const UTF_32LE_INIT: Encoding = Encoding::new("UTF-32LE", VariantEncoding::Utf32Le);
/// UTF-32LE
#[cfg(feature = "unicode-extras")]
pub static UTF_32LE: &Encoding = &UTF_32LE_INIT;

#[cfg(feature = "unicode-extras")]
pub(crate) const UTF_7_INIT: Encoding = Encoding::new("UTF-7", VariantEncoding::Utf7);
/// UTF-7
#[cfg(feature = "unicode-extras")]
pub static UTF_7: &Encoding = &UTF_7_INIT;