我阅读了很多关于如何将UTF-16 从/转换为 UTF-8 的帖子,但没有人建议如果我两者都有该怎么做。我正在尝试使用 PHP 将具有 UTF-16 和 UTF-8 字符的电子邮件正文文本插入 SQL Server 2008 表列 (UTF-8)。
我曾经iconv()
将 UTF-16 转换为 UTF-8,但正如我所说,这还不够,因为它不处理 UTF-8:
$email->description_html = iconv("UTF-16","UTF-8//TRANSLIT",$that->getMessageText(
$msgNo, 'HTML', $structure, $fullHeader,$clean_email));
$email->description = iconv("UTF-16","UTF-8//TRANSLIT",$that->getMessageText(
$msgNo, 'PLAIN', $structure, $fullHeader,$clean_email));
我对 UTF-16 和 UTF-8 都试过了,但它不起作用,出现数据库错误:
can't convert UTF-16 to UTF-8
$email->description_html= iconv('','UTF-8',$that->getMessageText(
$msgNo, 'HTML', $structure, $fullHeader,$clean_email));
我不知道还能做什么,请帮忙。