欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php编码转换函数(iconv mb_convert_encoding)

程序员文章站 2022-06-04 14:13:33
...
  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. ?>
复制代码