ddn.data.xml.internal.encoding

Internal: UTF-8 validation and normalization helpers.

This module is not part of the public API and may change at any time.

Types 2

Detected input encoding.

UTF8UTF-8.
UTF16_LEUTF-16, little-endian.
UTF16_BEUTF-16, big-endian.
UTF32_LEUTF-32, little-endian.
UTF32_BEUTF-32, big-endian.
ISO_8859_1ISO-8859-1 (Latin-1).
WINDOWS_1252Windows-1252 (CP1252).

XML version used for version-dependent checks.

XML_1_0XML 1.0
XML_1_1XML 1.1

Functions 12

fnXmlDetectedEncoding encodingFromName(string name) @safeMaps an encoding name to `XmlDetectedEncoding`.
fnstring tryParseXmlEncodingDeclarationAscii(const(ubyte)[] bytes) @safeAttempts to parse the XML declaration `encoding='...'` pseudo-attribute from raw bytes.
fnXmlDetectedEncoding encodingFromLabel(string label, out bool supported) @safeMaps a declared encoding label to an internal decoding choice.
fnXmlVersion parseXmlVersion(string versionString) @safe pure nothrowParses an XML version string.
fnbool isValidXmlChar(dchar c, XmlVersion xmlVersion = XmlVersion.XML_1_0) @safe pure nothrowReturns `true` if `c` is a valid XML character.
fnsize_t utf8BomLength(const(ubyte)[] bytes) @safe pure nothrowReturns the length of a UTF-8 BOM prefix in `bytes`.
fnXmlDetectedEncoding detectEncoding(const(ubyte)[] bytes) @safe pure nothrowDetects the encoding of `bytes`.
fnstring decodeToUtf8(const(ubyte)[] bytes, XmlDetectedEncoding encoding) @safeDecodes `bytes` into a UTF-8 `string` using the detected encoding.
private fnvoid appendUtf8CodePoint(ref typeof(appender!string()) sink, uint cp) @safe
fnbool isValidUtf8(const(ubyte)[] bytes) @safe pure nothrowValidates that `bytes` is well-formed UTF-8.
fnstring normalizeNewlines(string input)Normalizes XML newlines.
fnstring normalizeAttributeValue(string value) @safeNormalizes an XML attribute value.