<?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> <refentry xml:id="function.mb-convert-variables" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>mb_convert_variables</refname> <refpurpose>Convert character code in variable(s)</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>mb_convert_variables</methodname> <methodparam><type>string</type><parameter>to_encoding</parameter></methodparam> <methodparam><type>mixed</type><parameter>from_encoding</parameter></methodparam> <methodparam><type>mixed</type><parameter role="reference">vars</parameter></methodparam> <methodparam choice="opt"><type>mixed</type><parameter role="reference">...</parameter></methodparam> </methodsynopsis> <para> Converts character encoding of variables <parameter>vars</parameter> in encoding <parameter>from_encoding</parameter> to encoding <parameter>to_encoding</parameter>. </para> <para> <function>mb_convert_variables</function> join strings in Array or Object to detect encoding, since encoding detection tends to fail for short strings. Therefore, it is impossible to mix encoding in single array or object. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>to_encoding</parameter></term> <listitem> <para> The encoding that the <type>string</type> is being converted to. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>from_encoding</parameter></term> <listitem> <para> <parameter>from_encoding</parameter> is specified as an <type>array</type> or comma separated <type>string</type>, it tries to detect encoding from <parameter>from-coding</parameter>. When <parameter>from_encoding</parameter> is omitted, <literal>detect_order</literal> is used. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>vars</parameter></term> <listitem> <para> <parameter>vars</parameter> is the reference to the variable being converted. String, Array and Object are accepted. <function>mb_convert_variables</function> assumes all parameters have the same encoding. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>...</parameter></term> <listitem> <para> Additional <parameter>vars</parameter>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The character encoding before conversion for success, or &false; for failure. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>mb_convert_variables</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* Convert variables $post1, $post2 to internal encoding */ $interenc = mb_internal_encoding(); $inputenc = mb_convert_variables($interenc, "ASCII,UTF-8,SJIS-win", $post1, $post2); ?> ]]> </programlisting> </example> </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 -->