<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.unicode-set-error-mode">
 <refnamediv>
  <refname>unicode_set_error_mode</refname>
  <refpurpose>Set the error mode for strings conversions</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>unicode_set_error_mode</methodname>
   <methodparam><type>int</type><parameter>direction</parameter></methodparam>
   <methodparam><type>int</type><parameter>mode</parameter></methodparam>
  </methodsynopsis>
  <para>
   This function sets the error mode for string conversions between different
   encodings. An error can occur during conversion when an illegal character 
   is encountered or if a character cannot be represented into the new encoding.
   By default, when an error is encountered, the conversion stops.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>direction</parameter></term>
     <listitem>
      <para>
       The <parameter>direction</parameter> sets the conversion direction to
       which the error mode will apply. This can either be 
       <constant>FROM_UNICODE</constant>, which will set the error mode for 
       conversions from a <type>unicode</type> string to a binary string 
       or <constant>TO_UNICODE</constant>, which will set the error mode
       for conversions from a binary string to a <type>unicode</type> string.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>mode</parameter></term>
     <listitem>
      <para>
       <parameter>mode</parameter> determines how the conversion errors are 
       handled. It should be one of the following constants:
      </para>
      <para>
       <table>
        <title>Available modes</title>
        <tgroup cols="2">
         <thead>
          <row>
           <entry>Mode</entry>
           <entry>Description</entry>
          </row>
         </thead>
         <tbody>
          <row>
           <entry>
            <constant>U_CONV_ERROR_STOP</constant>
           </entry>
           <entry>
            Stop the conversion. This is the default mode.
           </entry>
          </row>
          <row>
           <entry>
            <constant>U_CONV_ERROR_SKIP</constant>
           </entry>
           <entry>
            Skip the character.
           </entry>
          </row>
          <row>
           <entry>
            <constant>U_CONV_ERROR_SUBST</constant>
           </entry>
           <entry>
            Substitute the character. The substituting character can be set with
            <function>unicode_set_subst_char</function>.
           </entry>
          </row>
          <row>
           <entry>
            <constant>U_CONV_ERROR_ESCAPE_UNICODE</constant>
           </entry>
           <entry>
            Escape the faulty bytes and represent them in the Unicode character
            format.
           </entry>
          </row>
          <row>
           <entry>
            <constant>U_CONV_ERROR_ESCAPE_ICU</constant>
           </entry>
           <entry>
            Escape the faulty bytes and represent them in the ICU character
            format.
           </entry>
          </row>
          <row>
           <entry>
            <constant>U_CONV_ERROR_ESCAPE_JAVA</constant>
           </entry>
           <entry>
            Escape the faulty bytes and print them in the Java character 
            format.
           </entry>
          </row>
          <row>
           <entry>
            <constant>U_CONV_ERROR_ESCAPE_XML_DEC</constant>
           </entry>
           <entry>
            Escape the faulty bytes and represent them in decimal format.
           </entry>
          </row>
          <row>
           <entry>
            <constant>U_CONV_ERROR_ESCAPE_XML_HEX</constant>
           </entry>
           <entry>
            Escape the faulty bytes and represent them in hexadecimal
            format.
           </entry>
          </row>
         </tbody>
        </tgroup>
       </table>
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>

 <refsect1 role="errors">
  &reftitle.errors;
  <para>
   Emits a <constant>E_WARNING</constant> level error if the direction or the
   mode are invalid.
  </para>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  &warn.experimental.func;
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>unicode_encode</function></member>
    <member><function>unicode_decode</function></member>
   </simplelist>
  </para>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->