Support Forums

Feed not UTF-8

This is a discussion on Feed not UTF-8 within the Technical Support forums, part of the Technical Support Forums category; My feed is not showing in UTF-8 format for some reason, even though I have changed it in my external.php, ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

Reply
 
Thread Tools Display Modes
Old 06-19-2010, 11:01 AM   #1
Customer
 
Join Date: Feb 2010
Location: Montreal, QC
Posts: 285
Rep Power: 12
EnergyFreak is on a distinguished road
Default Feed not UTF-8

My feed is not showing in UTF-8 format for some reason, even though I have changed it in my external.php, here is where I did the changes:

Code:
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n";
	echo '<rss version="2.0">' . "\r\n";
	echo "<channel>\r\n";
	echo "\t<title>Petites Annonces Gratuites du Qu�bec - Publito</title>\r\n";
	echo "\t<link>".URL."</link>\r\n";
	echo "\t<description>" . html_entity_decode($Core->settings['description']). "</description>\r\n";
	echo "\t<language>en</language>\r\n";
	echo "\t<generator>68 Classifieds</generator>\r\n";
	echo "\t<lastBuildDate>" . gmdate('D, d M Y H:i:s') . " GMT</lastBuildDate>\r\n";
	echo "\t<pubDate>" . gmdate('D, d M Y H:i:s') . " GMT</pubDate>\r\n";
Here is my feed

Last edited by EnergyFreak; 06-19-2010 at 11:03 AM.
EnergyFreak is offline   Reply With Quote
Old 06-19-2010, 03:48 PM   #2
Customer
 
Join Date: Feb 2010
Location: Montreal, QC
Posts: 285
Rep Power: 12
EnergyFreak is on a distinguished road
Default

I am not 100% sure yet but I may have solved it.
EnergyFreak is offline   Reply With Quote
Old 06-20-2010, 12:24 PM   #3
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,342
Rep Power: 84
seymourjames is a jewel in the rough
Default

I think you will also need to use CDATA like this as you are using French accented characters.


// print out the page header
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n";
echo '<rss version="2.0">' . "\r\n";
echo "<channel>\r\n";
echo "\t<title>French Property News</title>\r\n";
echo "\t<link>".URL."</link>\r\n";
echo "\t<description><![CDATA[" . html_entity_decode($Core->settings['description']). "]]></description>\r\n";
echo "\t<language>en</language>\r\n";
echo "\t<generator>68 Classifieds</generator>\r\n";
echo "\t<lastBuildDate>" . gmdate('D, d M Y H:i:s') . " GMT</lastBuildDate>\r\n";
echo "\t<pubDate>" . gmdate('D, d M Y H:i:s') . " GMT</pubDate>\r\n";


and a bit further down like this


echo "\t\t\t".'<title><![CDATA['. $listing['title'] . $seperator . $price .']]></title>'."\r\n";
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting
seymourjames is offline   Reply With Quote
Old 06-20-2010, 09:14 PM   #4
Customer
 
Join Date: Feb 2010
Location: Montreal, QC
Posts: 285
Rep Power: 12
EnergyFreak is on a distinguished road
Default

Hmm... That is interesting, i'll test it out to see if everything works fine and if not I will try your CDATA tags.
EnergyFreak is offline   Reply With Quote
Old 06-20-2010, 11:23 PM   #5
Customer
 
Join Date: Feb 2010
Location: Montreal, QC
Posts: 285
Rep Power: 12
EnergyFreak is on a distinguished road
Default

I wrapped all my titles and descriptions with CDATA tags but still no luck. Although now the special characters are replaced with different symbols. My feed on my website is working fine but my feed on other web sites is not showing them properly, is this normal?

This is what I get instead of an � = ‰ and for an � €
EnergyFreak is offline   Reply With Quote
Old 06-21-2010, 12:49 AM   #6
Customer
 
Join Date: Feb 2010
Location: Montreal, QC
Posts: 285
Rep Power: 12
EnergyFreak is on a distinguished road
Default

I found this little document on the internet but I am not sure I completely understand this.

Quote:
Telling the parser about your entities

You're not restricted to just the five named character entities covered above. In fact, you can use any that you want as long as you tell the parser what each name means.

Whether or not your document is based on an existing DTD, you can always declare your own entities in an internal DTD subset. This (optional) portion of a document's prolog looks something like the following.

<?xml version="1.0"?>
<!DOCTYPE rootelem [
<!ENTITY name "value">
]>
<rootelem>...</rootelem>

Here, rootelem would be replaced with the name of whatever your own document's root element is. As for the entity declaration, name will be whatever you want your entity to appear as in your document (that is, the text that appears between the & and ; characters); and value will be what you want the parser to substitute in the document when it encounters the entity reference.

For example,

<?xml version="1.0"?>
<!DOCTYPE names [
<!ENTITY ccedilla "ç">
]>
<names>
<name>Francçla;ois</name>
</names>

The parser -- and any downstream application to which it passes data -- will read this name as "Fran�ois."
Would this mean that I would be able to declare all my special characters inside my feed?
EnergyFreak is offline   Reply With Quote
Old 06-21-2010, 05:15 AM   #7
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,342
Rep Power: 84
seymourjames is a jewel in the rough
Default

contact me on my email and i will send you the external.php file I use.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting
seymourjames is offline   Reply With Quote
Old 06-21-2010, 10:53 AM   #8
Customer
 
Join Date: Feb 2010
Location: Montreal, QC
Posts: 285
Rep Power: 12
EnergyFreak is on a distinguished road
Default

Problem solved, Your feed worked perfectly, all I had to change was the enconding format to utf-8 and everything worked.

Thanks.
EnergyFreak is offline   Reply With Quote
Old 06-21-2010, 12:35 PM   #9
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,342
Rep Power: 84
seymourjames is a jewel in the rough
Default

Glad to be of assistance.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting
seymourjames is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
RSS Feed EnergyFreak Technical Support 12 03-10-2010 11:22 AM
Using external.php as RSS Feed- Damon Technical Support 2 03-14-2008 02:28 AM


All times are GMT -4. The time now is 08:45 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0