Handle byte-order-mark prefixes
Examples:
void[] INPUT2 = "abc\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86".dup;
void[] INPUT = x"efbbbf" ~ INPUT2;
auto bom = new UnicodeBom!(char)(Encoding.Unknown);
size_t ate;
char[256] buf;
auto temp = bom.decode (INPUT, buf, &ate);
assert (ate == INPUT.length);
assert (bom.encoding == Encoding.UTF_8);
temp = bom.decode (INPUT2, buf, &ate);
assert (ate == INPUT2.length);
assert (bom.encoding == Encoding.UTF_8);
- final @property Encoding encoding();
- Return the current encoding. This is either the originally
specified encoding, or a derived one obtained by inspecting
the content for a BOM. The latter is performed as part of
the decode() method
- final @property bool encoded();
- Was an encoding located in the text (configured via setup)
- final @property const(void)[] signature();
- Return the signature (BOM) of the current encoding
- final void setup(Encoding encoding, bool found = false);
- Configure this instance with unicode converters
- static const(Info)* test(void[] content);
- Scan the BOM signatures looking for a match. We scan in
reverse order to get the longest match first