<?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> <refentry xml:id="function.mb-detect-encoding" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>mb_detect_encoding</refname> <refpurpose>Detect character encoding</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type class="union"><type>string</type><type>false</type></type><methodname>mb_detect_encoding</methodname> <methodparam><type>string</type><parameter>string</parameter></methodparam> <methodparam choice="opt"><type class="union"><type>array</type><type>string</type><type>null</type></type><parameter>encodings</parameter><initializer>&null;</initializer></methodparam> <methodparam choice="opt"><type>bool</type><parameter>strict</parameter><initializer>&false;</initializer></methodparam> </methodsynopsis> <para> Detects character encoding in <type>string</type> <parameter>string</parameter>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>string</parameter></term> <listitem> <para> The <type>string</type> being detected. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>encodings</parameter></term> <listitem> <para> <parameter>encodings</parameter> is list of character encoding. Encoding order may be specified by array or comma separated list string. </para> <para> If <parameter>encodings</parameter> is omitted or &null;, detect_order is used. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>strict</parameter></term> <listitem> <para> <parameter>strict</parameter> specifies whether to use the strict encoding detection or not. Default is &false;. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> The detected character encoding or &false; if the encoding cannot be detected from the given string. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>mb_detect_encoding</function> example</title> <programlisting role="php"> <![CDATA[ <?php /* Detect character encoding with current detect_order */ echo mb_detect_encoding($str); /* "auto" is expanded according to mbstring.language */ echo mb_detect_encoding($str, "auto"); /* Specify "encodings" parameter by list separated by comma */ echo mb_detect_encoding($str, "JIS, eucjp-win, sjis-win"); /* Use array to specify "encodings" parameter */ $ary[] = "ASCII"; $ary[] = "JIS"; $ary[] = "EUC-JP"; echo mb_detect_encoding($str, $ary); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mb_detect_order</function></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 -->