php-doc-en/reference/xml/functions/utf8-encode.xml

117 lines
3.4 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.utf8-encode">
<refnamediv>
<refname>utf8_encode</refname>
<refpurpose>Encodes an ISO-8859-1 string to UTF-8</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>utf8_encode</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
This function converts the string <parameter>data</parameter> from the
<literal>ISO-8859-1</literal> encoding to <literal>UTF-8</literal>.
</para>
<note>
<para>
Many web pages marked as using the <literal>ISO-8859-1</literal> character
encoding actually use the similar <literal>Windows-1252</literal> encoding,
and web browsers will interpret <literal>ISO-8859-1</literal> web pages as
<literal>Windows-1252</literal>. <literal>Windows-1252</literal> features
additional printable characters, such as the Euro sign
(<literal></literal>) and curly quotes (<literal></literal>
<literal></literal>), instead of certain <literal>ISO-8859-1</literal>
control characters. This function will not convert such
<literal>Windows-1252</literal> characters correctly. Use a different
function if <literal>Windows-1252</literal> conversion is required.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
An ISO-8859-1 string.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the UTF-8 translation of <parameter>data</parameter>.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>7.2.0</entry>
<entry>
This function has been moved to the core of PHP, and therefore lifting the requirement
on the XML extension for this function to be available.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>utf8_decode</function> - Performs the reverse conversion</member>
<member><function>mb_convert_encoding</function> - Converts between various character encodings, including UTF-8, ISO-8859-1 and Windows-1252</member>
<member><function>iconv</function> - Converts between various character encodings</member>
<member><function>recode_string</function> - Converts between various character encodings</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
-->