RE: Character Range: surrogate blocks

Rick Jelliffe (ricko@allette.com.au)
Sun, 18 Oct 1998 19:43:08 +1000


> From: owner-xml-dev@ic.ac.uk [mailto:owner-xml-dev@ic.ac.uk]On Behalf Of
> Richard Emberson

> Why was it decided to exclude the uses of surrogate
> block-base Unicode characters within XML documents?

It makes no sense to allow numeric character references to surrogates. You
can directly use a numeric character reference to the character which the
surrogate-pair encodes!

Every character in a document on a computer is in some encoding. In
particular:--

* When stored in a file, an XML document may be encoded in any encoding that
IANA accepts (providing it has most of the ASCII characters), including
Unicode.

* When made available through DOM, an XML document is encoded using Unicode.

All characters (except Private-Area characters, by their nature) are
interpreted according to ISO 10646 specifications, regardless of their
encoding. A surrogate is not a character, in the abstract: it is an encoding
of a future ISO 10646 character with a value greater than (2^16)-1.

Before the addition of surrogates, Unicode characters took one codepoint,
and it was possible to speak loosely of ISO 10646 characters and Unicode
codepoints as if they were the same thing (more or less). That was one of
the charms of Unicode. But with the addition of surrogates, this convenience
does not apply (to the surrogate area) and life is more complicated.

Personally, I think we should aim at allowing *more* character encodings,
not fewer, in XML documents. Encoding is a compression optimized for a
locale. As long as the encoding of a document is clearly labelled, and the
transcoding of that encoding to ISO10646 is established, and as long as the
distinctions of codepoints/characters and standard/private characters is
kept, I can only think that multiple encodings do not represent a "mess",
but something of great value. However, this value probably does not extend
to text when it is inside an XML application: so the fact that DOM uses
Unicode, and not some more generic char* or wchar_t*, is to be applauded,
IMHO.

Rick Jelliffe