Encoding illegal XML names

SQL Anywhere uses the following rules for encoding names that are not legal XML names (for example, column names that include
spaces):

XML has rules for names that differ from rules for SQL names. For example, spaces are not allowed in XML names. When a SQL
name, such as a column name, is converted to an XML name, characters that are not valid characters for XML names are encoded
or escaped.

For each encoded character, the encoding is based on the character's Unicode code point value, expressed as a hexadecimal
number.

For most characters, the code point value can be represented with 16 bits or four hex digits, using the encoding _xHHHH_.
These characters correspond to Unicode characters whose UTF-16 value is one 16-bit word.

For characters whose code point value requires more than 16 bits, eight hex digits are used in the encoding _xHHHHHHHH_. These
characters correspond to Unicode characters whose UTF-16 value is two 16-bit words. However, the Unicode code point value,
which is typically 5 or 6 hex digits, is used for the encoding, not the UTF-16 value.