function convertStringUtf8 ($s)
{
file_put_contents ( '/tmp/utf8_param' , $s);
file_put_contents ( '/tmp/utf8_mbdetect' , mb_detect_encoding($s));
file_put_contents ( '/tmp/utf8_other' , iconv('ISO-8859-1', 'UTF-8//TRANSLIT', "Á"));
if (function_exists('iconv'))
{
file_put_contents ( '/tmp/utf8_func', "yes");
} else {
file_put_contents ( '/tmp/utf8_func', "nao");
};
$sutf8 = iconv('ISO-8859-1', 'UTF-8//TRANSLIT', $s);
file_put_contents ( '/tmp/utf8_iconv' , $sutf8);
return $sutf8;
};
/tmp
个文件的输出:
utf8_param
- “字符串”
utf8_mbdetect
- 空,0字节
utf8_other
- 'Ã'
utf8_func
- '是
utf8_iconv
- 空,0字节
“字符串”来自MariaDB
数据库并且Spanish
整理。 iconv
工作正常,但在我开发新程序时似乎出现了问题。转换后的字符串应传递给javascript
ajax
来电。
导致iconv