Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3340454
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:36:34+00:00 2026-05-18T00:36:34+00:00

I’m trying to write a RSS feed for a website which mostly has Russian

  • 0

I’m trying to write a RSS feed for a website which mostly has Russian articles, though sometimes English. The site is built with php mysql.
This is what the text looks like when I visit the url:

Áåñåäà ¹1 èç öèêëà “Èçðàèëü è ìû”

What am I doing wrong?
Also, I’m tryn to add this line of code on top of the document but it breaks it and I get an error:

<?xml version="1.0" encoding="UTF-8"?>

Here is my php code excluding the database connect info.
I’m desperate. Please help.

<?php
require_once ('cutils/db_connect.php3');
// PHP file that renders perfect Dynamic XML for MySQL Database result sets
// Script written by Adam Khoury @ www.developphp.com - April 05, 2010
// View the video that is tied to this script for maximum understanding
// -------------------------------------------------------------------
header("Content-Type: rss-http;"); //set the content type to xml
// Initialize the xmlOutput variable

$xmlBody = '
<rss version="2.0">

<channel>
<title>Name of your site</title>
<description>A description of your site</description>
<link>http://yoururl.com/</link>
<copyright>Your copyright information</copyright>';
// Connect to your MySQL database whatever way you like to here
mysql_connect("localhost","dbuser","dbpass") or die (mysql_error());
mysql_select_db("sinaius2_em") or die ("no database");
// Execute the Query on the database to select items(20 in this example)
$sql = mysql_query("SELECT `id`, `title`, `article_text`, `article_date` FROM `articles`ORDER BY `article_date` DESC LIMIT 0 , 15");
mysql_query("SET NAMES utf8");
while($row = mysql_fetch_array($sql)){
    // Set DB variables into local variables for easier use 
    $id = $row["id"]; 
    $title = $row["title"] ;  
    $date_time = strftime("%b %d, %Y", strtotime($row["article_date"])); 
    $description = $row["article_text"];  
    // Start filling the $xmlBody variable with looping content here inside the while loop 
    // It will loop through 20 items from the database and render into XML format
    $xmlBody .= "
<item> 
    <title>$title</title>
    <description>TEST</description>  
    <pubDate>$date_time</pubDate>
    <link>http://www.evreimir.com/article.php?id=$id</link> 
</item> ";
} // End while loop
mysql_close(); // close the mysql database connection_aborted
$xmlBody .= "</channel>
</rss>";
echo $xmlBody; // output the gallery data as XML file for flash
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:36:35+00:00Added an answer on May 18, 2026 at 12:36 am

    You can (and probably should) include the charset in your Content-Type header. Also, I’ve never seen the content type rss-http, I’d use either text/xml or application/xml. There also a few more specific content types, but there might be some issues with this. RSS is xml, so either generic xml content type will work fine.

    header("Content-Type: text/xml; charset=ISO-8859-1"); 
    

    ISO-8859 does include Cyrillic characters, but that may not be the charset your data is stored in here is a reference for various other Cyrillic charsets that are in-use. In any case, you should probably specify the same encoding that you’re using in your mysql database. You can use show create table your_table_name in mysql to see what the charset is for a given table (or for an individual column in the table).

    Also… the description field in RSS will be handled as HTML after the user agent extracts if from the XML document. For this reason, I strongly suggest that you wrap the content of your item description as CDATA. Even so, you’ll still need to entity encode things that you would normally entity encode in HTML text (like a “less-than” symbol that’s not part of an html tag). Here’s a good example page.

    <description><![CDATA[(5 &lt; 8) is math, but <b>this is bold text</b>]]></description>
    

    Notice how the HTML <b> tags don’t need encoding because they’re inside the CDATA, but the less-than symbol gets encoded anyway to escape it within the other HTML tags in the CDATA description. Without the CDATA, you’d need to xml-encode the contents of the description tag – which will require that the less-than in the above example actually be “double-encoded”. (so just use the CDATA, it’s much easier and less error-prone).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.