我正在尝试从另一个网站上的 rss 提要预览最新帖子。提要采用 UTF-8 编码,而网站采用 ISO-8859-1 编码。显示标题时,我正在使用;
$post_title = 'Blogging – does it pay the bills?';
echo mb_convert_encoding($post_title, 'iso-8859-1','utf-8');
// returns: Blogging ? does it pay the bills?
// expected: Blogging - does it pay the bills?
请注意,我期待的连字符不是正常的减号,而是一些大屁股超级破折号。好吧,无论如何要长几个像素。:) 不知道如何描述它,因为我的键盘无法产生那个字符......