• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Read a RSS feed into my html page

New Here ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

Hi
Just need some advice.
I have a rssfeed that is in swedish so i get some specialcharacters in it like åäöÅÄÖ.

I use this code
<cfhttp url=" http://blogg.fotbolldirekt.com/xml_consult.php" method="GET" resolveurl="no" charset="utf-8" ></cfhttp>
<cfset fdblogg_xml=XMLParse(cfhttp.FileContent)>

to call for the rss feed.

then i use this code to output the result

<cfloop index="x" from="1" to="3">
<tr><td colspan="2"><a href="#fdblogg_xml.rss.item.link.xmlText#" class="NewsName">#fdblogg_xml.rss.item.title.xmlText#</a></td></tr>
<tr><td valign="top"><img src="#fdblogg_xml.rss.item.urlthumb.xmlText#" border="0"></td><td valign="top" class="Text">#Mid(fdblogg_xml.rss.item.description.xmlText,1,80)#...</td></tr>
</cfloop>

Can anyone give me a hint, need to figure out how to get the specialcharacters to show correct on the webpage.

Thanks
Magnus
TOPICS
Advanced techniques

Views

672

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

Try adding this: <cfprocessingdirective pageEncoding="utf-8"> to the template.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

Hi again

And thanks but that didn't do the trick.

Any other suggestions?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

Put the processing directive at the top of the page.

Use the <cfsavecontent tag to set the encoding.

Put encoding code into metatags in the <head> of the document.

And I usually put in the <cfencoding...> tags in for forms and urls just
in case.

Do all the above all the time when working with encoding. And don't
forget any other layers: databases, xml documents, ect. They must all
agree on and use a consistent character set to prevent unpleasant behavior.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

Im sorry but i still cant make it work.

Here is my complete page in code...

<cfprocessingdirective pageEncoding="utf-8">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test RSS-feed</title>
<cfhttp url=" http://blogg.fotbolldirekt.com/xml_consult.php" method="GET" resolveurl="no" charset="utf-8"></cfhttp>
<cfset fdblogg_xml=XMLParse(cfhttp.FileContent)>
</head>

<body>
<cfoutput>
<table width="185">
<tr><td colspan="2" bgcolor="66CCFF"><b>FDs Bloggtips</b></td></tr>
<cfloop index="x" from="1" to="3">
<tr><td colspan="2"><a href="#fdblogg_xml.rss.item.link.xmlText#" class="NewsName">#fdblogg_xml.rss.item.title.xmlText#</a></td></tr>
<tr><td valign="top"><img src="#fdblogg_xml.rss.item.urlthumb.xmlText#" border="0"></td><td valign="top" class="Text">#Mid(fdblogg_xml.rss.item.description.xmlText,1,80)#...</td></tr>
</cfloop>
</table>
</cfoutput>
</body>
</html>

If it works for someone else then i can guess i have some config to do on the server.

/Magnus

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2007 Mar 20, 2007

Copy link to clipboard

Copied

i just tested your code and it worked absolutely fine... all Swedish
chars showed properly...

what's the page encoding setting in the browser you are viewing your
page with? make sure it is Unicode (UTF-8), too.
(I.e. in Firefox go to menu View -> Character Encoding -> select Unicode)
--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 21, 2007 Mar 21, 2007

Copy link to clipboard

Copied

LATEST
The one thing I would add is a <cfcontent...> tag.

<cfprocessingdirective pageEncoding="utf-8">
<cfcontent type="text/html; charset=utf-8" reset="yes">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation