问题
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...
Code:
$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>
';
Output:
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.
回答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);
来源:https://stackoverflow.com/questions/10864044/php-utf8-decode-to-wrong-character