Sarsmas Ahangari
Sarsmas Ahangari

Reputation: 7

Special Chars German not showing on PHP

$url2 = "http://feeds.4players.de/PC-CDROM/news/-/rss.xml";
$output2 = "";

if($rss2 = @simplexml_load_file($url2)) {
$i2=0;
    foreach($rss2->channel->item as $item2) {
        $output2 .= "<h3>{$item2->title}</h3>";
        $output2 .= "<p>{$item2->description}</p>";
        $output2 .= "<div><a href=\"{$item2->link}\" target=\"_blank\">zum Artikel</a></div><hr>";
$i2++;
if($i2==8) break;
    }
    echo utf8_decode($output2);
} else {
    echo "<div>Einlesen der Datei nicht erfolgreich</div>";
}

This my code and wont show up the special chars? I've tried to set at meta tag even the utf 8, but I guess it is about that it is an Variable and resads from RSS, so the rest of the Website shows the Specialchars!

Upvotes: 0

Views: 39

Answers (1)

Alex Black
Alex Black

Reputation: 462

It works good enter image description here

 $url2 = "http://feeds.4players.de/PC-CDROM/news/-/rss.xml";
                    $output2 = "";
    
                    if($rss2 = @simplexml_load_file($url2)) {
                        $i2=0;
                        foreach($rss2->channel->item as $item2) {
                            $output2 .= "<h3>{$item2->title}</h3>";
                            $output2 .= "<p>{$item2->description}</p>";
                            $output2 .= "<div><a href=\"{$item2->link}\" target=\"_blank\">zum Artikel</a></div><hr>";
                            $i2++;
                            if($i2==8) break;
                        }
                        echo $output2;
                    } else {
                        echo "<div>Einlesen der Datei nicht erfolgreich</div>";
                    }

Upvotes: 1

Related Questions