Skip to main content

Module encoding

Module encoding 

Source
Expand description

Character encoding handling (§22, §85 Phase 4).

Encoding detection, XML declaration encoding, BOM behavior, UTF-8/UTF-16 validity, legacy encodings, conversion errors, output conversion, serializer fallback, custom encoding handlers.

§Architecture

ABI exports (exports_xml2.rs)  ←  pub(crate) functions in this module
                                          ↕
                          Encoding handler registry (global RwLock)
                                          ↕
             Built-in handlers: UTF-8, UTF-16LE, UTF-16BE, Latin-1, ASCII

The internal encoding is always UTF-8. All conversions go to/from UTF-8. The handler registry stores _xmlCharEncodingHandler structs that contain function pointers for input (→UTF-8) and output (UTF-8→) conversion.