要解决此问题,我需要在iconv
:
setlocale( LC_ALL, "pt_BR.UTF-8");
因此,转换是正确的(在我的情况下,因为我的站点位于
pt_BR
):
<?php
$filename = "ação";
setlocale( LC_ALL, "pt_BR.UTF-8"); // fix the locale
$filename = iconv( \'UTF-8\', \'ASCII//TRANSLIT\', $filename); // convert latin characters
echo $filename; // shows "acao"
正确结果:
acao公司