Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 12681

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Character Encoding</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="xml.error-codes.html">Error Codes</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="xml.examples.html">Examples</a></div>
 <div class="up"><a href="book.xml.html">XML Parser</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="xml.encoding" class="article">
 <h1>Character Encoding</h1>

 <p class="para">
  PHP&#039;s XML extension supports the <a href="http://www.unicode.org/" class="link external">&raquo;&nbsp;Unicode</a> character set through
  different <span class="glossterm">character encoding</span>s.  There are
  two types of character encodings, <span class="glossterm">source
  encoding</span> and <span class="glossterm">target encoding</span>.
  PHP&#039;s internal representation of the document is always encoded
  with <em>UTF-8</em>.
 </p>
 <p class="para">
  Source encoding is done when an XML document is <a href="function.xml-parse.html" class="link">parsed</a>.  Upon <a href="function.xml-parser-create.html" class="link">creating an XML
  parser</a>, a source encoding can be specified (this encoding
  can not be changed later in the XML parser&#039;s lifetime).  The
  supported source encodings are <em>ISO-8859-1</em>,
  <em>US-ASCII</em> and <em>UTF-8</em>.  The
  former two are single-byte encodings, which means that each
  character is represented by a single byte.
  <em>UTF-8</em> can encode characters composed by a
  variable number of bits (up to 21) in one to four bytes.  The
  default source encoding used by PHP is
  <em>ISO-8859-1</em>.
 </p>
 <p class="para">
  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.
 </p>
 <p class="para">
  If the XML parser encounters characters outside the range that
  its source encoding is capable of representing, it will return
  an error.  
 </p>
 <p class="para">
  If PHP encounters characters in the parsed XML document that can
  not be represented in the chosen target encoding, the problem
  characters will be &quot;demoted&quot;.  Currently, this means that such
  characters are replaced by a question mark.
 </p>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="xml.error-codes.html">Error Codes</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="xml.examples.html">Examples</a></div>
 <div class="up"><a href="book.xml.html">XML Parser</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>