Home > Backend Development > PHP Tutorial > PHP encoding conversion function (iconv mb_convert_encoding)

PHP encoding conversion function (iconv mb_convert_encoding)

WBOY
Release: 2016-07-25 08:53:58
Original
888 people have browsed it
  1. echo iconv("ISO-8859-1", "UTF-8", "This is a test.");
  2. ?>
复制代码

2,mb_convert_encoding函数语法 :

  1. /* Convert internal character encoding to SJIS */

  2. $str = mb_convert_encoding($str, "SJIS");

  3. /* Convert EUC-JP to UTF-7 */

  4. $str = mb_convert_encoding($str, "UTF-7", "EUC-JP");

  5. /* Auto detect encoding from JIS, eucjp-win, sjis-win, then convert str to UCS-2LE */

  6. $str = mb_convert_encoding($str, "UCS-2LE", "JIS, eucjp-win, sjis-win");

  7. /* "auto" is expanded to "ASCII,JIS,UTF-8,EUC-JP,SJIS" */

  8. $str = mb_convert_encoding($str, "EUC-JP", "auto");
  9. ?>

复制代码


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template