WXforum.net
Web Weather => Weather Website PHP/AJAX scripting => Custom Website Templates => Topic started by: txweather.org on April 17, 2019, 03:32:13 PM
-
I got TweetWX from Ken working but my tweets have some odd data...
NWS fcst: ThisAfternoonChc Shwrs And T-Storms : , Hi 79°F ↓; TonightShwrs And T-Storms : , Lo 66°F ↑; ThuShwrs And T-Storms : , Hi 79°F ↓; #weather
Notice the &uarr and the &darr
-
Yep.. that's deliberate and from the NWS. The ↓ is a down-arrow character, the ↑ is a up-arrow -- both indicate changes in temperature beyond what is 'normal' for the period.
Both are done as HTML entities and not raw UTF-8 characters (which are needed for Twitter) since the data that appears in your normal forecast (index and wxforecast pages) are both ISO-8859-1 character sets, and a UTF-8 character for those arrows would result in a 'blob' character display on your website.
You can change TweetWX-forecast.php from $utfmessage = iconv('ISO-8859-1','UTF-8//TRANSLIT',$message);
to $utfmessage = iconv('ISO-8859-1','UTF-8//TRANSLIT',$message);
$utfmessage = html_entity_decode($utfmessage,ENT_NOQUOTES,'UTF-8');
and that should make Twitter happy.
-
Thanks Ken!