Witam. Mam takie dwa skrypty wyświetlające wiadomości z kanału RSS. Działają one tylko w takiej postaci jak poniżej - tz. z kodowaniem utf-8. Po zmianie na iso-8859-2 pojawiają się krzaki. Czy mogę prosić o "dodatek" odpowiedzialny za kodowanie?
<?php
// rss page for Testing -
$feed_url = "adres rss";
$xml = simplexml_load_file($feed_url);
// How many items to display
$count = 10;
// How many characters from each item
// 0 (zero) will show them all.
$char = 100;
foreach ($xml->channel->item as $item) {
if($char == 0){
$newstring = $item->description;
}
else{
$newstring = substr($item->description, 0
, $char); }
if($count > 0){
//in case they have non-closed italics or bold, etc ...
echo"</i></b></u></a>\n"; <div style='font-family:arial; font-size:.8em;'>
<b>{$item->title}</b><br />
$newstring ... <a href='{$item->guid}'>read more</a>
<br /><br />
</div>
";
}
$count--;
}
?>
<?php
$doc = new DOMDocument('1.0', 'utf-8');
$doc->load('adres rss');
$title = $doc->getElementsByTagName('title');
$link = $doc->getElementsByTagName('link');
for($i = 0; $i < $title->length; ++$i)
{
echo '<a href="'.$link->item($i)->nodeValue.'" target="_blank">'.$title->item($i)->nodeValue.'</a><br/>'; }
?>