Skip to main content
removeu 117 caracteres do conteúdo
Fonte Link
user6026
user6026

Tente assim com utf8_encode, porque pelo que você ta dizendo na sua tabela está aAdicione essa linha antes da collation$query como, latin1mysql_query("SET NAMES 'utf8'"); e ocasiona esses caracteres estranhos.

header("Content-Type: application/rss+xml; charset=utf-8");

$rssfeed = '<?xml version="1.0" encoding="utf-8"?>';
$rssfeed .= '<rss version="2.0">';
$rssfeed .= '<channel>';
$rssfeed .= '<title>RSS feed</title>';
$rssfeed .= '<link>http://www.xxxxxxxxxxxxx.pt</link>';
$rssfeed .= '<description>RSS feed</description>';
$rssfeed .= '<language>en-us</language>';
$rssfeed .= '<copyright>Copyright (C) 2014 xxxxxxxxxxxxx.pt</copyright>';

$data = date("Y-m-d");
mysql_query("SET NAMES 'utf8'");
$query = "SELECT * FROM tbl_noticias WHERE data = '$data' ORDER BY id DESC";
$result = mysql_query($query) or die ("Could not execute query");

while($row = mysql_fetch_array($result)) {
    $title =  utf8_encode($row['titulo']);$row['titulo'];
    $title = utf8_encode($title);$title;
    $description = utf8_encode($row['intro']);$row['intro'];
    $date = $row['data']." - ".$row['hora'];
    $link = "http://www.xxxxxxxxxxxxx.pt/detalhe.php?id=".$row['id'];
    $image = "http://www.xxxxxxxxxxxxx.pt/images/resize_listagem/".$row['foto'];

    $rssfeed .= '<item>';
    $rssfeed .= '<title>' . $title . '</title>';
    $rssfeed .= '<description>' . $description . '<![CDATA[<br><img src="' . $image . '" />]]></description>';
    $rssfeed .= '<link>' . $link . '</link>';
    $rssfeed .= '<pubDate>' .$date. '</pubDate>';
    $rssfeed .= '</item>';
}

Referência:

Tente assim com utf8_encode, porque pelo que você ta dizendo na sua tabela está a collation como latin1 e ocasiona esses caracteres estranhos.

header("Content-Type: application/rss+xml; charset=utf-8");

$rssfeed = '<?xml version="1.0" encoding="utf-8"?>';
$rssfeed .= '<rss version="2.0">';
$rssfeed .= '<channel>';
$rssfeed .= '<title>RSS feed</title>';
$rssfeed .= '<link>http://www.xxxxxxxxxxxxx.pt</link>';
$rssfeed .= '<description>RSS feed</description>';
$rssfeed .= '<language>en-us</language>';
$rssfeed .= '<copyright>Copyright (C) 2014 xxxxxxxxxxxxx.pt</copyright>';

$data = date("Y-m-d");
$query = "SELECT * FROM tbl_noticias WHERE data = '$data' ORDER BY id DESC";
$result = mysql_query($query) or die ("Could not execute query");

while($row = mysql_fetch_array($result)) {
    $title =  utf8_encode($row['titulo']);
    $title = utf8_encode($title);
    $description = utf8_encode($row['intro']);
    $date = $row['data']." - ".$row['hora'];
    $link = "http://www.xxxxxxxxxxxxx.pt/detalhe.php?id=".$row['id'];
    $image = "http://www.xxxxxxxxxxxxx.pt/images/resize_listagem/".$row['foto'];

    $rssfeed .= '<item>';
    $rssfeed .= '<title>' . $title . '</title>';
    $rssfeed .= '<description>' . $description . '<![CDATA[<br><img src="' . $image . '" />]]></description>';
    $rssfeed .= '<link>' . $link . '</link>';
    $rssfeed .= '<pubDate>' .$date. '</pubDate>';
    $rssfeed .= '</item>';
}

Adicione essa linha antes da $query, mysql_query("SET NAMES 'utf8'");

header("Content-Type: application/rss+xml; charset=utf-8");

$rssfeed = '<?xml version="1.0" encoding="utf-8"?>';
$rssfeed .= '<rss version="2.0">';
$rssfeed .= '<channel>';
$rssfeed .= '<title>RSS feed</title>';
$rssfeed .= '<link>http://www.xxxxxxxxxxxxx.pt</link>';
$rssfeed .= '<description>RSS feed</description>';
$rssfeed .= '<language>en-us</language>';
$rssfeed .= '<copyright>Copyright (C) 2014 xxxxxxxxxxxxx.pt</copyright>';

$data = date("Y-m-d");
mysql_query("SET NAMES 'utf8'");
$query = "SELECT * FROM tbl_noticias WHERE data = '$data' ORDER BY id DESC";
$result = mysql_query($query) or die ("Could not execute query");

while($row = mysql_fetch_array($result)) {
    $title =  $row['titulo'];
    $title = $title;
    $description = $row['intro'];
    $date = $row['data']." - ".$row['hora'];
    $link = "http://www.xxxxxxxxxxxxx.pt/detalhe.php?id=".$row['id'];
    $image = "http://www.xxxxxxxxxxxxx.pt/images/resize_listagem/".$row['foto'];

    $rssfeed .= '<item>';
    $rssfeed .= '<title>' . $title . '</title>';
    $rssfeed .= '<description>' . $description . '<![CDATA[<br><img src="' . $image . '" />]]></description>';
    $rssfeed .= '<link>' . $link . '</link>';
    $rssfeed .= '<pubDate>' .$date. '</pubDate>';
    $rssfeed .= '</item>';
}

Referência:

Fonte Link
user6026
user6026

Tente assim com utf8_encode, porque pelo que você ta dizendo na sua tabela está a collation como latin1 e ocasiona esses caracteres estranhos.

header("Content-Type: application/rss+xml; charset=utf-8");

$rssfeed = '<?xml version="1.0" encoding="utf-8"?>';
$rssfeed .= '<rss version="2.0">';
$rssfeed .= '<channel>';
$rssfeed .= '<title>RSS feed</title>';
$rssfeed .= '<link>http://www.xxxxxxxxxxxxx.pt</link>';
$rssfeed .= '<description>RSS feed</description>';
$rssfeed .= '<language>en-us</language>';
$rssfeed .= '<copyright>Copyright (C) 2014 xxxxxxxxxxxxx.pt</copyright>';

$data = date("Y-m-d");
$query = "SELECT * FROM tbl_noticias WHERE data = '$data' ORDER BY id DESC";
$result = mysql_query($query) or die ("Could not execute query");

while($row = mysql_fetch_array($result)) {
    $title =  utf8_encode($row['titulo']);
    $title = utf8_encode($title);
    $description = utf8_encode($row['intro']);
    $date = $row['data']." - ".$row['hora'];
    $link = "http://www.xxxxxxxxxxxxx.pt/detalhe.php?id=".$row['id'];
    $image = "http://www.xxxxxxxxxxxxx.pt/images/resize_listagem/".$row['foto'];

    $rssfeed .= '<item>';
    $rssfeed .= '<title>' . $title . '</title>';
    $rssfeed .= '<description>' . $description . '<![CDATA[<br><img src="' . $image . '" />]]></description>';
    $rssfeed .= '<link>' . $link . '</link>';
    $rssfeed .= '<pubDate>' .$date. '</pubDate>';
    $rssfeed .= '</item>';
}