Character Encoding
PHP's XML extension supports the » Unicode character set through
different character encodings. There are
two types of character encodings, source
encoding and target encoding.
PHP's internal representation of the document is always encoded
with
Source encoding is done when an XML document is parsed. Upon creating an XML
parser, a source encoding can be specified (this encoding
can not be changed later in the XML parser's lifetime). The
supported source encodings are Target encoding is done when PHP passes data to XML handler functions. When an XML parser is created, the target encoding is set to the same as the source encoding, but this may be changed at any point. The target encoding will affect character data as well as tag names and processing instruction targets. If the XML parser encounters characters outside the range that its source encoding is capable of representing, it will return an error. If PHP encounters characters in the parsed XML document that can not be represented in the chosen target encoding, the problem characters will be "demoted". Currently, this means that such characters are replaced by a question mark. |