为什么编码错误?

I am trying to create rss feed. I use yii framework.

Here is my partial view

<?php
header("Content-Type: application/xml; charset=utf-8");
?>
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">

    <channel>
        <title>Newskeeper</title>
        <link>newskeeper.ru</link>
        <description>news</description>

        <?php
        $HOST = "http://newskeeper.ru/";
        $HOST_NEWS = "news#news_";
        $IMAGE_PATH = $HOST . "news/sendshow?id=";

        foreach($news as $item) {
            $date=date("D, j M Y G:i:s", $item['create_time']). " GMT";

            echo '<item>';
                echo '<title>' . utf8_encode(html_entity_decode($item['teaser_ru']))  . '</title>';
                echo '<link>' . utf8_encode(html_entity_decode($HOST .$HOST_NEWS . $item['slug'])) . '</link>';
                echo '<description>' .utf8_encode(html_entity_decode($item['text_ru'])). '</description>';
            echo '</item>';
        }
        ?>

    </channel>
</rss>

and here is the method in a controller class

public function actionRss() {
    $sql = "select id, teaser_ru, text_ru, slug, create_time from news order by create_time desc limit 10";
    $command = Yii::app()->db->createCommand($sql);
    $news = $command->queryAll();
    $this->renderPartial("_rss", array('news' => $news));
}

The question is why does not it show russian letter. It shows them in wrong encoding.

I found the issue. I overencoded it. You need to remove utf8_encode and add second and third param to html_entity_decode, so the item of rss feed should look like this

echo '<item>';
     echo '<title>' . html_entity_decode($item['teaser_ru'], ENT_COMPAT, 'utf-8')  . '</title>';
     echo '<link>' . html_entity_decode($HOST .$HOST_NEWS . $item['slug'], ENT_COMPAT, 'utf-8') . '</link>';
     echo '<description>' . html_entity_decode($item['text_ru'], ENT_COMPAT, 'utf-8') . '</description>';
echo '</item>';