Unicode is an encoding of textual material. The purpose of this module
is to interface external-encoding with a programmer-defined internal-
encoding. This internal encoding is declared via the template argument
T, whilst the external encoding is either specified or derived.
Three internal encodings are supported: char, wchar, and dchar. The
methods herein operate upon arrays of this type. That is, decode()
returns an array of the type, while encode() expect an array of said
type.
Supported external encodings are as follow:
Encoding.Unknown
Encoding.UTF_8N
Encoding.UTF_8
Encoding.UTF_16
Encoding.UTF_16BE
Encoding.UTF_16LE
Encoding.UTF_32
Encoding.UTF_32BE
Encoding.UTF_32LE
These can be divided into non-explicit and explicit encodings:
Encoding.Unknown
Encoding.UTF_8
Encoding.UTF_16
Encoding.UTF_32
Encoding.UTF_8N
Encoding.UTF_16BE
Encoding.UTF_16LE
Encoding.UTF_32BE
Encoding.UTF_32LE
The former group of non-explicit encodings may be used to 'discover'
an unknown encoding, by examining the first few bytes of the content
for a signature. This signature is optional, but is often written such
that the content is self-describing. When an encoding is unknown, using
one of the non-explicit encodings will cause the decode() method to look
for a signature and adjust itself accordingly. It is possible that a
ZWNBSP character might be confused with the signature; today's unicode
content is supposed to use the WORD-JOINER character instead.
The group of explicit encodings are for use when the content encoding
is known. These *must* be used when converting back to external encoding,
since written content must be in a known format. It should be noted that,
during a decode() operation, the existence of a signature is in conflict
with these explicit varieties.
See
http://www.utf-8.com/
http://www.hackcraft.net/xmlUnicode/
http://www.unicode.org/faq/utf_bom.html/
http://www.azillionmonkeys.com/qed/unicode.html/
http://icu.sourceforge.net/docs/papers/forms_of_unicode/