<?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 encodes the string <parameter>data</parameter> to <literal>UTF-8</literal>, and returns the encoded version. <literal>UTF-8</literal> is a standard mechanism used by <acronym>Unicode</acronym> for encoding <glossterm>wide character</glossterm> values into a byte stream. <literal>UTF-8</literal> is transparent to plain <abbrev>ASCII</abbrev> characters, is self-synchronized (meaning it is possible for a program to figure out where in the bytestream characters start) and can be used with normal string comparison functions for sorting and such. PHP encodes <literal>UTF-8</literal> characters in up to four bytes, like this: <table> <title>UTF-8 encoding</title> <tgroup cols="3"> <thead> <row> <entry>bytes</entry> <entry>bits</entry> <entry>representation</entry> </row> </thead> <tbody> <row> <entry>1</entry> <entry>7</entry> <entry>0bbbbbbb</entry> </row> <row> <entry>2</entry> <entry>11</entry> <entry>110bbbbb 10bbbbbb</entry> </row> <row> <entry>3</entry> <entry>16</entry> <entry>1110bbbb 10bbbbbb 10bbbbbb</entry> </row> <row> <entry>4</entry> <entry>21</entry> <entry>11110bbb 10bbbbbb 10bbbbbb 10bbbbbb</entry> </row> </tbody> </tgroup> </table> Each <replaceable>b</replaceable> represents a bit that can be used to store character data. </para> </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> </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 -->