Added the unicode_set_error_mode() function

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@241598 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nick Berard 2007-08-19 19:56:38 +00:00
parent 3da874b5c4
commit 8695af1c22

View file

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<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 Unicode conversions</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>direction</methodname>
<type>int</type><methodname>mode</methodname>
</methodsynopsis>
<para>
This function sets the error mode for string conversions. An error can occur
during conversion when an illegal character is encountered or if a character
cannot be represented into the new encoding.
</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 in another encoding or <constant>TO_UNICODE</constant>,
which will set the error mode for conversions from a binary string to an
<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.
</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:"../../../../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
-->