2009-11-19 13:13:35 +00:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
2009-07-11 07:28:18 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.iconv" xmlns="http://docbook.org/ns/docbook">
|
2007-02-03 05:34:30 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>iconv</refname>
|
|
|
|
<refpurpose>Convert string to requested character encoding</refpurpose>
|
|
|
|
</refnamediv>
|
2007-02-03 05:35:03 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-02-03 05:34:30 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>string</type><methodname>iconv</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>in_charset</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>out_charset</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>str</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
Performs a character set conversion on the string
|
|
|
|
<parameter>str</parameter> from <parameter>in_charset</parameter>
|
2007-02-03 05:35:03 +00:00
|
|
|
to <parameter>out_charset</parameter>.
|
2007-02-03 05:34:30 +00:00
|
|
|
</para>
|
2007-02-03 05:35:03 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>in_charset</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The input charset.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>out_charset</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The output charset.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
If you append the string <literal>//TRANSLIT</literal> to
|
|
|
|
<parameter>out_charset</parameter> transliteration is activated. This
|
|
|
|
means that when a character can't be represented in the target charset,
|
|
|
|
it can be approximated through one or several similarly looking
|
|
|
|
characters. If you append the string <literal>//IGNORE</literal>,
|
|
|
|
characters that cannot be represented in the target charset are silently
|
|
|
|
discarded. Otherwise, <parameter>str</parameter> is cut from the first
|
2009-04-17 07:36:59 +00:00
|
|
|
illegal character and an <constant>E_NOTICE</constant> is generated.
|
2007-02-03 05:35:03 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>str</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The string to be converted.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
2009-11-09 10:26:08 +00:00
|
|
|
Returns the converted string&return.falseforfailure;.
|
2007-02-03 05:34:30 +00:00
|
|
|
</para>
|
2007-02-03 05:35:03 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2007-02-03 05:34:30 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
2007-02-03 05:35:03 +00:00
|
|
|
<title><function>iconv</function> example</title>
|
2007-02-03 05:34:30 +00:00
|
|
|
<programlisting role="php">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
2003-07-16 17:25:02 +00:00
|
|
|
<?php
|
2009-04-17 07:36:59 +00:00
|
|
|
$text = "This is the Euro symbol '€'.";
|
|
|
|
|
|
|
|
echo 'Original : ', $text, PHP_EOL;
|
|
|
|
echo 'TRANSLIT : ', iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text), PHP_EOL;
|
|
|
|
echo 'IGNORE : ', iconv("UTF-8", "ISO-8859-1//IGNORE", $text), PHP_EOL;
|
|
|
|
echo 'Plain : ', iconv("UTF-8", "ISO-8859-1", $text), PHP_EOL;
|
|
|
|
|
2003-07-16 17:25:02 +00:00
|
|
|
?>
|
2002-04-15 00:12:54 +00:00
|
|
|
]]>
|
2007-02-03 05:34:30 +00:00
|
|
|
</programlisting>
|
2009-04-17 07:36:59 +00:00
|
|
|
&example.outputs.similar;
|
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
|
|
|
Original : This is the Euro symbol '€'.
|
|
|
|
TRANSLIT : This is the Euro symbol 'EUR'.
|
|
|
|
IGNORE : This is the Euro symbol ''.
|
|
|
|
Plain :
|
|
|
|
Notice: iconv(): Detected an illegal character in input string in .\iconv-example.php on line 7
|
|
|
|
This is the Euro symbol '
|
|
|
|
]]>
|
|
|
|
</screen>
|
2007-02-03 05:34:30 +00:00
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-02-03 05:35:03 +00:00
|
|
|
|
2007-02-03 05:34:30 +00:00
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-04-15 00:12:54 +00:00
|
|
|
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
|
|
|
|
-->
|