philip Fri Feb 2 05:52:50 2007 UTC
Modified files:
/phpdoc/en/reference/unicode/functions unicode-encode.xml
Log:
Documented this function (but will leave it marked undocumented as it's
not complete). The new example is based off a user note (Hugo Dworak). Added
the flags parameter, error role, and more.
Removed See Also unicode_decode() as this isn't in the manual (yet).
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/unicode/functions/unicode-encode.xml?r1=1.1&r2=1.2&diff_format=u
Index: phpdoc/en/reference/unicode/functions/unicode-encode.xml
diff -u phpdoc/en/reference/unicode/functions/unicode-encode.xml:1.1
phpdoc/en/reference/unicode/functions/unicode-encode.xml:1.2
--- phpdoc/en/reference/unicode/functions/unicode-encode.xml:1.1 Fri Sep
9 22:12:34 2005
+++ phpdoc/en/reference/unicode/functions/unicode-encode.xml Fri Feb 2
05:52:50 2007
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<refentry id="function.unicode-encode">
<refnamediv>
<refname>unicode_encode</refname>
- <refpurpose>Takes a unicode string and converts it to a string in the
specified encoding</refpurpose>
+ <refpurpose>Set encoding of a unicode string</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
@@ -11,8 +11,13 @@
<type>string</type><methodname>unicode_encode</methodname>
<methodparam><type>unicode</type><parameter>input</parameter></methodparam>
<methodparam><type>string</type><parameter>encoding</parameter></methodparam>
+ <methodparam><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
&warn.undocumented.func;
+ <para>
+ Takes a <type>unicode</type> string and converts it to a string in
+ the specified <parameter>encoding</parameter>.
+ </para>
</refsect1>
<refsect1 role="parameters">
@@ -23,7 +28,7 @@
<term><parameter>input</parameter></term>
<listitem>
<para>
- Its description
+ The <type>unicode</type> string that will be encoded.
</para>
</listitem>
</varlistentry>
@@ -31,7 +36,15 @@
<term><parameter>encoding</parameter></term>
<listitem>
<para>
- Its description
+ The new encoding for <parameter>input</parameter>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><parameter>flags</parameter></term>
+ <listitem>
+ <para>
+ Flags
</para>
</listitem>
</varlistentry>
@@ -42,31 +55,45 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- What the function returns, first on success, then on failure.
+ A <type>string</type> on success, or &false; on failure.
</para>
</refsect1>
+<refsect1 role="errors">
+ &reftitle.errors;
+ <para>
+ Emits a <constant>E_WARNING</constant> level error if a converter cannot
+ be created for the desired <parameter>encoding</parameter>.
+ </para>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>unicode_encode</function> example</title>
<para>
- Any text that describes the purpose of t
+ Note: The characters will be seen instead of entities in the output.
</para>
<programlisting role="php">
<![CDATA[
<?php
-if ($anexample === true) {
- echo 'Use the PEAR Coding Standards';
-}
+header ('Content-Type: text/plain; charset=ISO-8859-2');
+
+$encoded = unicode_encode ('\u0150\u0179', 'ISO-8859-2');
+
+echo 'Unicode semantics: ', ini_get ('unicode_semantics'), PHP_EOL;
+echo 'The string itself:', $encoded, PHP_EOL;
+echo 'The length of the string: ', strlen ($encoded);
?>
]]>
</programlisting>
- &example.outputs;
+ &example.outputs.similar;
<screen>
<![CDATA[
-Use the PEAR Coding Standards
+Unicode semantics: 1
+The string itself: ŐŹ
+The length of the string: 2
]]>
</screen>
</example>
@@ -77,7 +104,7 @@
&reftitle.seealso;
<para>
<simplelist>
- <member><function>unicode_decode</function></member>
+ <member><function>unicode_symantics</function></member>
</simplelist>
</para>
</refsect1>