Unable to display French characters in RSS feed without encoding errors
I am trying to display the contents of an RSS feed with sample data as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0">
<channel>
<title>NHL.com Nouvelles</title>
<link>http://www.nhl.com</link>
<description>Nouvelles</description>
<copyright>NHL Enterprises, L.P. (c) 2011 NHL. All Rights Reserved</copyright>
<language>fr-ca</language>
<lastBuildDate>Sun, 31 Jul 2011 21:14:47 EDT</lastBuildDate>
<item>
<title>L'attaquant Zach Parise signe un contrat d'une
saison avec les Devils
</title>
<link><![CDATA[http://www.nhl.com/ice/news.htm?id=585498&cmpid=rss-Nouvelles]]>
</link>
<description><![CDATA[ NEWARK, États-Unis -
L'attaquant Zach Parise a accepté un contrat d'une saison avec
les Devils du New Jersey. Lors de l'annonce en fin d'après-midi vendredi,
le président et directeur-général des Devils Lou Lamoriello
a ajouté que les deux parti...]]>
</description>
<pubDate>Fri, 29 Jul 2011 19:04:04 EDT</pubDate>
<guid><![CDATA[http://www.nhl.com/ice/news.htm?id=585498]]></guid>
</item>
<!-- other item nodes -->
</channel>
</rss>
The feed is encoded as ISO-8859-1. I have tried two scripts to 开发者_运维知识库display the feed on my site and it doesn't appear correct. I noticed that even when viewing the XML file in my browser the characters are not displayed properly.
I have used two different JavaScript solutions to display the feed on my site and neither of them display the characters properly either.
Does anyone know a pre-built RSS to HTML script in any language that will encode the incoming XML file properly?
If not, any suggestions on how I can encode it properly myself?
I ran into a similar problem before.
You will need to change the charset
in your HTML.
This worked for me.
<meta charset="ISO-8859">
EDIT
Just noticed this too... your description
content is garbled. You will need to re-enter it in your text-editor or whatever you are using to code. Looks like that program/application mangled it. Could be part of the reason nothing is working.
<description><![CDATA[ NEWARK, États-Unis -
L'attaquant Zach Parise a accepté un contrat d'une saison avec
les Devils du New Jersey. Lors de l'annonce en fin d'après-midi vendredi,
le président et directeur-général des Devils Lou Lamoriello
a ajouté que les deux parti...]]>
</description>
Also, you should consider changing the French characters to ascii or hex values, like
téléphonique
to
téléphonique
精彩评论