pub enum Encoding {
Show 13 variants
Utf8,
Ascii,
Latin1,
Windows1252,
Utf16Le,
Utf16Be,
Utf32Le,
Utf32Be,
Ebcdic037,
Ebcdic500,
Ebcdic1047,
Ebcdic1140,
Other(String),
}Expand description
A character encoding the parser may encounter.
Variants§
Utf8
UTF-8 — variable-length, the modern default.
Ascii
US-ASCII — 7-bit subset of UTF-8. Transcoding is a no-op.
Latin1
ISO-8859-1, also known as Latin-1. Byte X maps directly to U+00XX.
Windows1252
Windows-1252 (codepage 1252). Identical to Latin-1 outside the 0x80–0x9F range, which Windows-1252 uses for printable characters (curly quotes, em dash, ellipsis, €, etc.).
Utf16Le
UTF-16 little-endian. Detected via the FF FE BOM or an explicit
encoding="UTF-16LE" declaration.
Utf16Be
UTF-16 big-endian. Detected via the FE FF BOM or an explicit
encoding="UTF-16BE" declaration.
Utf32Le
UTF-32 little-endian. Detected via the FF FE 00 00 BOM, the XML
Appendix F autodetect signature 3C 00 00 00, or an explicit
encoding="UTF-32LE" / encoding="UCS-4LE" declaration.
Utf32Be
UTF-32 big-endian. Detected via the 00 00 FE FF BOM, the XML
Appendix F autodetect signature 00 00 00 3C, or an explicit
encoding="UTF-32BE" / encoding="UCS-4BE" declaration.
Ebcdic037
IBM037 (CCSID 37 / CP037), the EBCDIC US/Canada Latin code page.
Detected via the XML spec’s Appendix F autodetection signature
4C 6F A7 94 (= “<?xm” in EBCDIC) — which all IBM-family variants
share — or an explicit encoding="IBM037" declaration.
Ebcdic500
IBM500 (CCSID 500), International EBCDIC. Same control-character
layout as IBM037 with seven ASCII-region punctuation positions
rearranged. Detected via the IBM037 autodetect signature plus an
explicit encoding="IBM500" declaration.
Ebcdic1047
IBM1047 (CCSID 1047), EBCDIC Open Systems / z/OS Unix Services Latin-1. Differs from IBM037 in the IBM500 ASCII-region punctuation plus the LF/NEL swap that makes EBCDIC text behave under Unix line-handling code.
Ebcdic1140
IBM1140 (CCSID 1140), EBCDIC US/Canada Latin with the Euro sign update. Identical to IBM037 except byte 0x9F maps to U+20AC (€) instead of U+00A4 (¤).
Other(String)
A recognized encoding name we do not yet know how to transcode. Stored as the name as written in the document’s XML declaration.