php-doc-en/functions/recode.xml

138 lines
4.4 KiB
XML
Raw Normal View History

<reference id="ref.recode">
<title>GNU Recode functions</title>
<titleabbrev>Recode</titleabbrev>
<partintro>
<para>
This module contains an interface to the GNU Recode library,
version 3.5. To be able to use the functions defined in this
module you must compile you PHP interpreter using the --with-recode
option. In order to do so, you must have GNU Recode 3.5 or higher
installed on your system.
</para>
<para>
The GNU Recode library converts files between various coded
character sets and surface encodings. When this cannot be
achieved exactly, it may get rid of the offending characters or
fall back on approximations. The library recognises or produces
nearly 150 different character sets and is able to convert files
between almost any pair. Most RFC 1345 character sets are supported.
</para>
</partintro>
<refentry id="function.recode-string">
<refnamediv>
<refname>recode_string</refname>
<refpurpose>Recode a string according to a recode request</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>recode_string</function></funcdef>
<paramdef>string <parameter>request</parameter></paramdef>
<paramdef>string <parameter>string</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Recode the string <parameter>string</parameter> according to
the recode request <parameter>request</parameter>. Returns the
recoded string or FALSE, if unable to perform the recode request.
</para>
<para>
A simple recode request may be &quot;lat1..iso646-de&quot;.
See also the GNU Recode documentation of your installation
for detailed instructions about recode requests.
<example>
<title>Basic <function>recode_string</function> example:</title>
<programlisting role="php">
print recode_string (&quot;us..flat&quot;, &quot;The following character has a diacritical mark: &amp;aacute;&quot;);
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.recode">
<refnamediv>
<refname>recode</refname>
<refpurpose>Recode a string according to a recode request</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>recode</function></funcdef>
<paramdef>string <parameter>request</parameter></paramdef>
<paramdef>string <parameter>string</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<note>
<simpara>
This is an alias for <function>recode_string</function>. It has
been added in PHP 4.
</simpara>
</note>
</refsect1>
</refentry>
<refentry id="function.recode-file">
<refnamediv>
<refname>recode_file</refname>
<refpurpose>
Recode from file to file according to recode request
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>boolean <function>recode_file</function></funcdef>
<paramdef>string <parameter>request</parameter></paramdef>
<paramdef>resource <parameter>input</parameter></paramdef>
<paramdef>resource <parameter>output</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Recode the file referenced by file handle
<parameter>input</parameter> into the file referenced by file
handle <parameter>output</parameter> according to the recode
<parameter>request</parameter>. Returns FALSE, if unable to
comply, TRUE otherwise.
</para>
<para>
This function does not currently process filehandles referencing
remote files (URLs). Both filehandles must refer to local files.
</para>
<para>
<example>
<title>Basic <function>recode_file</function> example</title>
<programlisting role="php">
$input = fopen ('input.txt', 'r');
$output = fopen ('output.txt', 'w');
recode_file (&quot;us..flat&quot;, $input, $output);
</programlisting>
</example>
</para>
</refsect1>
</refentry>
</reference>
<!-- 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
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->