XML technologies / XML / XML in a Nutshell / Internationalization
(Excerpt from "XML in a Nutshell" by Elliotte Rusty Harold & W. Scott Means)
We have told you that XML documents contain text, but have not yet explained what kind of text. The following pages will remedy this omission. XML documents contain Unicode text. Unicode is a character set large enough to accommodate all the world’s living languages and a few dead ones as well. It can use various encodings, including UCS-2 and the ASCII superset UTF-8. Since Unicode text editors are not so widespread, XML documents can also be written using other character sets and encodings, which are then converted to Unicode when the document is parsed. The encoding declaration specifies the character set used by a document. You can use character references such as θ to insert Unicode characters such as θ that are not available in the character set used to write a document.
Computers do not really understand text. They cannot recognize the Latin letter Z, the Greek letter γ, or the Han character 譓. All a computer understands is numbers such as 90, 947, or 40,821. A character set maps particular characters, such as Z, to particular numbers, such as 90. These numbers are called code points ( Code Points). A character encoding specifies how these code points are represented as bytes. For example, code point 90 could be encoded as a signed byte, an unsigned LSB short, a four-byte word, two’s complement, an MSB integer, or in other, more complicated ways.
A human writing system such as Cyrillic could use several character sets, such as KOI8-R, Unicode, or ISO-8859-5. A character set such as Unicode can, in turn, use several encodings, such as UTF-8, UCS-2, or UTF-16. Simpler character sets such as ASCII and KOI8-R, however, have only one encoding.
Copyright © 2005 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from the book "XML in a Nutshell" is subject to the same conditions as the printed edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de
back to top