1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 297028 $ -->
<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
-->
|