mb_convert_encodingConvert a string from one character encoding to another
&reftitle.description;
arraystringfalsemb_convert_encodingarraystringstringstringto_encodingarraystringnullfrom_encoding&null;
Converts string from from_encoding,
or the current internal encoding, to to_encoding.
If string is an &array;, all its &string; values will be
converted recursively.
&reftitle.parameters;
string
The &string; or &array; to be converted.
to_encoding
The desired encoding of the result.
from_encoding
The current encoding used to interpret string.
Multiple encodings may be specified as an &array; or comma separated
list, in which case the correct encoding will be guessed using the
same algorithm as mb_detect_encoding.
If from_encoding is omitted or &null;, the
mbstring.internal_encoding setting
will be used if set, otherwise the default_charset setting.
See supported encodings
for valid values of to_encoding
and from_encoding.
&reftitle.returnvalues;
The encoded &string; or &array; on success, &return.falseforfailure;.
&reftitle.errors;
As of PHP 8.0.0, a ValueError is thrown if the
value of to_encoding or
from_encoding is an invalid encoding.
Prior to PHP 8.0.0, a E_WARNING was emitted instead.
&reftitle.changelog;
&Version;&Description;8.2.0mb_convert_encoding will no longer return
the following non text encodings:
"Base64", "QPrint",
"UUencode", "HTML entities",
"7 bit" and "8 bit".
8.0.0mb_convert_encoding will now throw a
ValueError when
to_encoding is passed an invalid encoding.
8.0.0mb_convert_encoding will now throw a
ValueError when
from_encoding is passed an invalid encoding.
8.0.0from_encoding is nullable now.
7.2.0
This function now also accepts an &array; as string.
Formerly, only &string;s have been supported.
&reftitle.examples;
mb_convert_encoding example
]]>
&reftitle.seealso;
mb_detect_orderUConverter::transcodeiconv