reference/iconv/functions/iconv.xml
a223531900823441f82d178ca4e94c0444f24576
...
...
@@ -3,21 +3,20 @@
3
3
<refentry xml:id="function.iconv" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>iconv</refname>
6
-
<refpurpose>Convert string to requested character encoding</refpurpose>
6
+
<refpurpose>Convert a string from one character encoding to another</refpurpose>
7
7
</refnamediv>
8
8
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>string</type><methodname>iconv</methodname>
13
-
<methodparam><type>string</type><parameter>in_charset</parameter></methodparam>
14
-
<methodparam><type>string</type><parameter>out_charset</parameter></methodparam>
15
-
<methodparam><type>string</type><parameter>str</parameter></methodparam>
12
+
<type class="union"><type>string</type><type>false</type></type><methodname>iconv</methodname>
13
+
<methodparam><type>string</type><parameter>from_encoding</parameter></methodparam>
14
+
<methodparam><type>string</type><parameter>to_encoding</parameter></methodparam>
15
+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
-
Performs a character set conversion on the string
19
-
<parameter>str</parameter> from <parameter>in_charset</parameter>
20
-
to <parameter>out_charset</parameter>.
18
+
Converts <parameter>string</parameter> from <parameter>from_encoding</parameter>
19
+
to <parameter>to_encoding</parameter>.
21
20
</para>
22
21
</refsect1>
23
22

...
...
@@ -26,36 +25,45 @@
26
25
<para>
27
26
<variablelist>
28
27
<varlistentry>
29
-
<term><parameter>in_charset</parameter></term>
28
+
<term><parameter>from_encoding</parameter></term>
30
29
<listitem>
31
30
<para>
32
-
The input charset.
31
+
The current encoding used to interpret <parameter>string</parameter>.
33
32
</para>
34
33
</listitem>
35
34
</varlistentry>
36
35
<varlistentry>
37
-
<term><parameter>out_charset</parameter></term>
36
+
<term><parameter>to_encoding</parameter></term>
38
37
<listitem>
39
38
<para>
40
-
The output charset.
39
+
The desired encoding of the result.
41
40
</para>
42
41
<para>
43
-
If you append the string <literal>//TRANSLIT</literal> to
44
-
<parameter>out_charset</parameter> transliteration is activated. This
42
+
If the string <literal>//TRANSLIT</literal> is appended to
43
+
<parameter>to_encoding</parameter>, then transliteration is activated. This
45
44
means that when a character can't be represented in the target charset,
46
-
it can be approximated through one or several similarly looking
47
-
characters. If you append the string <literal>//IGNORE</literal>,
45
+
it may be approximated through one or several similarly looking
46
+
characters. If the string <literal>//IGNORE</literal> is appended,
48
47
characters that cannot be represented in the target charset are silently
49
-
discarded. Otherwise, <parameter>str</parameter> is cut from the first
50
-
illegal character and an <constant>E_NOTICE</constant> is generated.
48
+
discarded. Otherwise, <constant>E_NOTICE</constant> is generated and the function
49
+
will return &false;.
51
50
</para>
51
+
<caution>
52
+
<para>
53
+
If and how <literal>//TRANSLIT</literal> works exactly depends on the
54
+
system's iconv() implementation (cf. <constant>ICONV_IMPL</constant>).
55
+
Some implementations are known to ignore <literal>//TRANSLIT</literal>,
56
+
so the conversion is likely to fail for characters which are illegal for
57
+
the <parameter>to_encoding</parameter>.
58
+
</para>
59
+
</caution>
52
60
</listitem>
53
61
</varlistentry>
54
62
<varlistentry>
55
-
<term><parameter>str</parameter></term>
63
+
<term><parameter>string</parameter></term>
56
64
<listitem>
57
65
<para>
58
-
The string to be converted.
66
+
The &string; to be converted.
59
67
</para>
60
68
</listitem>
61
69
</varlistentry>
...
...
@@ -66,7 +74,7 @@
66
74
<refsect1 role="returnvalues">
67
75
&reftitle.returnvalues;
68
76
<para>
69
-
Returns the converted string&return.falseforfailure;.
77
+
Returns the converted string,&return.falseforfailure;.
70
78
</para>
71
79
</refsect1>
72
80

...
...
@@ -96,15 +104,35 @@ TRANSLIT : This is the Euro symbol 'EUR'.
96
104
IGNORE : This is the Euro symbol ''.
97
105
Plain :
98
106
Notice: iconv(): Detected an illegal character in input string in .\iconv-example.php on line 7
99
-
This is the Euro symbol '
100
107
]]>
101
108
</screen>
102
109
</example>
103
110
</para>
104
111
</refsect1>
105
112

106
-
</refentry>
113
+
<refsect1 role="notes">
114
+
&reftitle.notes;
115
+
<note>
116
+
<para>
117
+
The character encodings and options available depend on the installed implementation
118
+
of iconv. If the argument to <parameter>from_encoding</parameter>
119
+
or <parameter>to_encoding</parameter> is not supported on the current system, &false;
120
+
will be returned.
121
+
</para>
122
+
</note>
123
+
</refsect1>
107
124

125
+
<refsect1 role="seealso">
126
+
&reftitle.seealso;
127
+
<para>
128
+
<simplelist>
129
+
<member><function>mb_convert_encoding</function></member>
130
+
<member><methodname>UConverter::transcode</methodname></member>
131
+
</simplelist>
132
+
</para>
133
+
</refsect1>
134
+

135
+
</refentry>
108
136
<!-- Keep this comment at the end of the file
109
137
Local variables:
110
138
mode: sgml
111
139