PHP-utf8_decode()字符错误 [英] PHP - utf8_decode() to wrong character
本文介绍了PHP-utf8_decode()字符错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试使用Twitter搜索API.当我在转发的推文上拨打utf8_decode
时,得到语音标记/引号显示为问号...
Trying to use the Twitter search API. When I call utf8_decode
on a re-tweeted tweet I get speech marks/quotes appear as question marks...
代码:
$output .= '
<div class="leftcoltweet">
<div class="timg">
<a href="' . $account . '" target="_blank"><img src="' . $image .'"></a>
</div>
<div class="ttweet">
' . utf8_decode($tweet) . '
</div>
<div class="clr"></div>
<div class="ttime">' . $time . '</div>
<div class="clr"></div>
</div>
';
输出:
RT @IVAOAERO: ?@FilipJonckers: We are aware of and working on a fix for the ATIS issue introduced after last nights network upgrade http://t.co/6FODzr0Y?
所有其他符号正确显示.
All other symbols display correctly.
我必须设置要使用的语言吗?如果您想知道我进行的原子查询或其他事项,请告诉我.
Do I have to set a language to use? If you want to know the atom query I make or anything else then let me know.
推荐答案
请注意,utf8_decode()
仅对iso-8859-1(拉丁)编码的字符串有效.
如果您知道字符串的字符集,则可以调用:
note that utf8_decode()
works ONLY with iso-8859-1 (latin) encoded string.
if you know the character set of the string, you can call:
echo iconv("THE_CHARSET","utf8",$tweet);
这篇关于PHP-utf8_decode()字符错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文