<HTML ><HEAD ><TITLE >mb_detect_order</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual de PHP" HREF="index.html"><LINK REL="UP" TITLE="Multi-Byte String Functions" HREF="ref.mbstring.html"><LINK REL="PREVIOUS" TITLE="mb_detect_encoding" HREF="function.mb-detect-encoding.html"><LINK REL="NEXT" TITLE="mb_encode_mimeheader" HREF="function.mb-encode-mimeheader.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual de PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.mb-detect-encoding.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.mb-encode-mimeheader.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.mb-detect-order" ></A >mb_detect_order</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN36298" ></A ><P > (PHP 4 >= 4.0.6)</P >mb_detect_order -- Set/Get character encoding detection order </DIV ><DIV CLASS="refsect1" ><A NAME="AEN36301" ></A ><H2 >Description</H2 >array <B CLASS="methodname" >mb_detect_order</B > ( [mixed encoding-list])<BR ></BR ><P > <B CLASS="function" >mb_detect_order()</B > sets automatic character encoding detection order to <TT CLASS="parameter" ><I >encoding-list</I ></TT >. It returns <TT CLASS="constant" ><B >TRUE</B ></TT > for success, <TT CLASS="constant" ><B >FALSE</B ></TT > for failure. </P ><P > <TT CLASS="parameter" ><I >encoding-list</I ></TT > is array or comma separated list of character encoding. ("auto" is expanded to "ASCII, JIS, UTF-8, EUC-JP, SJIS") </P ><P > If <TT CLASS="parameter" ><I >encoding-list</I ></TT > is omitted, it returns current character encoding detection order as array. </P ><P > This setting affects <A HREF="function.mb-detect-encoding.html" ><B CLASS="function" >mb_detect_encoding()</B ></A > and <A HREF="function.mb-send-mail.html" ><B CLASS="function" >mb_send_mail()</B ></A >. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > <TT CLASS="literal" >mbstring</TT > currently implements following encoding detection filters. If there is a invalid byte sequence for following encoding, encoding detection will fail. </P ><P ><B >Nota: </B > <TT CLASS="literal" >UTF-8</TT >, <TT CLASS="literal" >UTF-7</TT >, <TT CLASS="literal" >ASCII</TT >, <TT CLASS="literal" >EUC-JP</TT >,<TT CLASS="literal" >SJIS</TT >, <TT CLASS="literal" >eucJP-win</TT >, <TT CLASS="literal" >SJIS-win</TT >, <TT CLASS="literal" >JIS</TT >, <TT CLASS="literal" >ISO-2022-JP</TT > </P ><P > For <TT CLASS="literal" >ISO-8859-*</TT >, <TT CLASS="literal" >mbstring</TT > always detects as <TT CLASS="literal" >ISO-8859-*</TT >. </P ><P > For <TT CLASS="literal" >UTF-16</TT >, <TT CLASS="literal" >UTF-32</TT >, <TT CLASS="literal" >UCS2</TT > and <TT CLASS="literal" >UCS4</TT >, encoding detection will fail always. </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN36344" ></A ><P ><B >Ejemplo 1. Useless detect order example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="programlisting" >; Always detect as ISO-8859-1 detect_order = ISO-8859-1, UTF-8 ; Always detect as UTF-8, since ASCII/UTF-7 values are ; valid for UTF-8 detect_order = UTF-8, ASCII, UTF-7</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></BLOCKQUOTE ></DIV ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN36348" ></A ><P ><B >Ejemplo 2. <B CLASS="function" >mb_detect_order()</B > examples</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >/* Set detection order by enumerated list */ mb_detect_order("eucjp-win,sjis-win,UTF-8"); /* Set detection order by array */ $ary[] = "ASCII"; $ary[] = "JIS"; $ary[] = "EUC-JP"; mb_detect_order($ary); /* Display current detection order */ echo implode(", ", mb_detect_order());</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > See also <A HREF="function.mb-internal-encoding.html" ><B CLASS="function" >mb_internal_encoding()</B ></A >, <A HREF="function.mb-http-input.html" ><B CLASS="function" >mb_http_input()</B ></A >, <A HREF="function.mb-http-output.html" ><B CLASS="function" >mb_http_output()</B ></A > <A HREF="function.mb-send-mail.html" ><B CLASS="function" >mb_send_mail()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.mb-detect-encoding.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Inicio</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.mb-encode-mimeheader.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >mb_detect_encoding</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.mbstring.html" ACCESSKEY="U" >Subir</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >mb_encode_mimeheader</TD ></TR ></TABLE ></DIV ></BODY ></HTML >