php iconv translit for removing accents: not working as excepted?

后端 未结 7 1236
终归单人心
终归单人心 2020-12-10 06:09

consider this simple code:

echo iconv(\'UTF-8\', \'ASCII//TRANSLIT\', \'è\');

it prints

 `e

instead of ju

相关标签:
7条回答
  • 2020-12-10 07:02

    It seem that it depend of the php version...


    TestCase #1

    php -version
    

    PHP 7.0.0RC8 (cli) (built: Nov 25 2015 12:36:50) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

    php -r "var_dump(iconv('UTF-8', 'ASCII//TRANSLIT', 'è'));"
    
    string(2) "`e"
    

    TestCase #2

    php -version
    

    PHP 7.0.8-1~dotdeb+8.1 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.8-1~dotdeb+8.1, Copyright (c) 1999-2016, by Zend Technologies

    php -r "var_dump(iconv('UTF-8', 'ASCII//TRANSLIT', 'è'));"
    
    string(1) "e"
    
    0 讨论(0)
提交回复
热议问题