FeedForAll Forum Index  
 Home  •  FAQ  •   Search   •  Register   •  Profile   •  Log in
 HTML within RSS not working View next topic
View previous topic
Post new topicReply to topic
Author Message
dartiss



Joined: 17 Nov 2008
Posts: 1
Location: Nottingham, UK

PostPosted: Mon Nov 17, 2008 2:52 pm Reply with quoteBack to top

Hi,

I've recently installed the latest version of RSS2HTML on my own server. However, I can't get it to work properly. In a nutshell, it appears that the greater and less than signs in any RSS feed are being lost - hence any embedded links, etc, are not working.

Here is a basic example using the supplied template (i.e. the one that comes with download) but my own feed, all hosted on my site...

http://www.bmtg.org.uk/test/rss2html.php?TEMPLATE=http://www.bmtg.org.uk/test/sample-template.html&XMLFILE=http://bmtgnews.blogspot.com/feeds/posts/default

As you can see from the first news item...

Quote:
If you shop on the internet then you could also help the society - a href="http://www.bmtg.org.uk/shop"our new online shopping facility /ahas dozens of shops and using any of them will raise much-needed revenue for the group.


Can anybody assist with this?

Much appreciated,
David.
View user's profileVisit poster's website
motleypixel



Joined: 12 Dec 2008
Posts: 5

PostPosted: Fri Dec 12, 2008 1:24 pm Reply with quoteBack to top

Hummm...this looks strikenly similiar to my issue I posted here: http://www.feedforall.com/forum/viewtopic.php?t=5812

-Roy
View user's profile
Tech Support



Joined: 27 Aug 2004
Posts: 2793

PostPosted: Fri Dec 12, 2008 2:38 pm Reply with quoteBack to top

Can you take a look at the source to the rss2html.php script. On around line 12 it will tell the version you are running. Can you post that version back here?

Thanks

_________________
Create RSS Feeds
Audio Recording and Editing
View user's profile
motleypixel



Joined: 12 Dec 2008
Posts: 5

PostPosted: Fri Dec 12, 2008 3:26 pm Reply with quoteBack to top

Should be the latest version:

Code:
// $Id: rss2html.php,v 3.13 2008/10/18 12:52:36 housley Exp $


Thanks,
Roy
View user's profile
motleypixel



Joined: 12 Dec 2008
Posts: 5

PostPosted: Mon Dec 15, 2008 11:57 am Reply with quoteBack to top

It's fixed now.
Check http://www.motleypixel.com/test/html.php?subalbums=Root

I didnít fix thisÖa developer help me with this. This problem arose when our host upgraded from 4.X php to 5.2.9 php.

Problem: rss2.html parser script FeedForAll_XMLParser.inc.php is not handling '&' in rss feed description (just like it didn't for < and >)

Ive modified the parser to add a line,
$XMLString = str_replace("&amp;", "&", $XMLString);

Just letting you all know.

-Roy
View user's profile
orthodoxws



Joined: 17 Oct 2009
Posts: 1

PostPosted: Sat Oct 17, 2009 12:49 am Reply with quoteBack to top

I tried adding:

$XMLString = str_replace("&lt;", "<", $XMLString);
$XMLString = str_replace("&gt;", ">", $XMLString);
$XMLString = str_replace("&amp;", "&", $XMLString);

But now I receive:

$errorCode = 26
xml_error_string() = Undeclared entity error
xml_get_current_line_number() = 13
xml_get_current_column_number() = 22
xml_get_current_byte_index() = 443

How can I get html to display? It keeps getting stripped.
View user's profile
Erinyes



Joined: 06 Aug 2009
Posts: 5

PostPosted: Wed Nov 04, 2009 9:01 am Reply with quoteBack to top

I had the same problem with the display of "<" or ">" or "&".

I recently solved this issue through the following.

I use a PostgreSQL database and I allow the users to input anything into the title or description including all special characters. Whilst I had trouble using "&lt;" and "&gt;" with the rss2html - scripts, it went totally fine with writing the ascii encoded formats into the database and then converting them with the FeedForAll_XMLParser.inc.php.

Notice:
All values of the ascii table are without the starting "&" at the beginning because otherwise one couldn't see the code display in this post correctly - very odd... ( normally would be like e.g. &#062 )

I used:

Code:
$current_value = str_replace(">","#62;", $current_value);
$current_value = str_replace("<","#60;", $current_value);
$current_value = str_replace("\"","#34;", $current_value);
$current_value = str_replace("'","#39;", $current_value);
$current_value = str_replace("&","#38;", $current_value);


in the PHP script to write them into the database.

When I read them again per script producing a HTML file with it, every tag inside the description and/or title field would convert to their respective tag like "<li>" or "<p>". This also worked for every kind of character like double quote or single quote.

Moreover I needed to modify the rss2html.php in the way, that it would convert the ascii values back to their original characters because else the website would not display correctly on my linux machine and would only show the tags "<li>" or "<ul>" but wouldn't do anything with them e.g. showing a list or the text in italics. So I added the following into the script file ( just below this line: $template = str_replace("&apos;", "'", $template); )

Code:
$template = str_replace("#60;","<", $template);
$template = str_replace("#62;", ">", $template);
$template = str_replace("#34;", "\"", $template);
$template = str_replace("#39;", "'", $template);
$template = str_replace("#38;", "&", $template);


so that the characters are converted back. After this step was done everything worked like a charm.

Hope that helps.

Erinyes
View user's profile
whiterabbit



Joined: 11 Nov 2009
Posts: 3

PostPosted: Wed Nov 11, 2009 5:16 pm Reply with quoteBack to top

I struggled with the same problem for about a week and was finally able to solve it (thanks in part to finding this thread!) by adding the following code to the FeedForAll_XMLParser.inc.php file, to the large list within Function FeedForAll_preProcessXML($XMLString):

Code:
$XMLString = str_replace("&gt;",">", $XMLString);
$XMLString = str_replace("&lt;","<", $XMLString);
$XMLString = str_replace("&amp;","&", $XMLString);


I hope this helps someone!
View user's profile
elektronikmuzak



Joined: 17 Dec 2009
Posts: 10

PostPosted: Mon Dec 21, 2009 8:17 pm Reply with quoteBack to top

whiterabbit wrote:
I struggled with the same problem for about a week and was finally able to solve it (thanks in part to finding this thread!) by adding the following code to the FeedForAll_XMLParser.inc.php file, to the large list within Function FeedForAll_preProcessXML($XMLString):

Code:
$XMLString = str_replace("&gt;",">", $XMLString);
$XMLString = str_replace("&lt;","<", $XMLString);
$XMLString = str_replace("&amp;","&", $XMLString);


I hope this helps someone!


Absolutely this helped me. Thank you: whiterabbit
View user's profile
elektronikmuzak



Joined: 17 Dec 2009
Posts: 10

PostPosted: Mon Dec 21, 2009 11:02 pm Reply with quoteBack to top

elektronikmuzak wrote:
whiterabbit wrote:
I struggled with the same problem for about a week and was finally able to solve it (thanks in part to finding this thread!) by adding the following code to the FeedForAll_XMLParser.inc.php file, to the large list within Function FeedForAll_preProcessXML($XMLString):

Code:
$XMLString = str_replace("&gt;",">", $XMLString);
$XMLString = str_replace("&lt;","<", $XMLString);
$XMLString = str_replace("&amp;","&", $XMLString);


I hope this helps someone!


Absolutely this helped me. Thank you: whiterabbit



UPDATE:

The above code was working for my rss2html page (used for displaying my single combined feed {built with rssMesh}), then at some point tonight, the rss2html page threw an error code:


Code:
$errorCode = 68
xml_error_string() = XML_ERR_NAME_REQUIRED
xml_get_current_line_number() = 13
xml_get_current_column_number() = 152
xml_get_current_byte_index() = 754




So cleared my cache, and modified this (PREVIOUSLY ADDED) code within FeedForAll_XMLParser.inc.php, from:

Code:
$XMLString = str_replace("&gt;",">", $XMLString);
$XMLString = str_replace("&lt;","<", $XMLString);
$XMLString = str_replace("&amp;","&", $XMLString);



To this:

Code:
$XMLString = str_replace("&gt;","#062;", $XMLString);
$XMLString = str_replace("&lt;","#060;", $XMLString);
$XMLString = str_replace("&amp;","#038;", $XMLString);

(you must add "&" before each of the entity # {pound signs
preceding the entity number}
, as stated in an earlier post above
)


Afterward, the modified str_replace entries match the format of the original str_replace entries within FeedForAll_XMLParser.inc.php.

And my rss2html page functions correctly again, without errors.
View user's profile
moyoungs



Joined: 10 Feb 2010
Posts: 3

PostPosted: Wed Feb 10, 2010 5:12 pm Reply with quoteBack to top

The information in this thread is very good, however the latest post shows adding the following code:
Code:
   $XMLString = str_replace("&gt;","#062;", $XMLString);
   $XMLString = str_replace("&lt;","#060;", $XMLString);
   $XMLString = str_replace("&amp;","#038;", $XMLString);

I am running version 3.22 and the following code works (add the ampersand before the pound sign)
Code:
   $XMLString = str_replace("&gt;",">", $XMLString);
   $XMLString = str_replace("&lt;","<", $XMLString);
   $XMLString = str_replace("&amp;","&", $XMLString);

to be consistent with the list in the FeedForAll_XMLParser.inc.php at around line 320. More precisely:
Code:
FeedForAll_preProcessXML($XMLString)

where the list of replacements starts. Thanks for your help WhiteRabbit!!
View user's profile
moyoungs



Joined: 10 Feb 2010
Posts: 3

PostPosted: Wed Feb 10, 2010 5:23 pm Reply with quoteBack to top

This editor converts the code to a symbol, so there is no way to provide you with the proper encoding except by saying the proper code is:
quotation mark ampersand pound sign 062 semicolon quotation mark.
quotation mark ampersand pound sign 060 semicolon quotation mark.
quotation mark ampersand pound sign 038 semicolon quotation mark.

Hope this helps as I see others have struggled with it.
View user's profile
moyoungs



Joined: 10 Feb 2010
Posts: 3

PostPosted: Wed Feb 10, 2010 5:35 pm Reply with quoteBack to top

Here is the code, you have to trick the editor into displaying it properly:
Code:
$XMLString = str_replace("&gt;","&#062;", $XMLString);
$XMLString = str_replace("&lt;","&#060;", $XMLString);
$XMLString = str_replace("&amp;","&#038;", $XMLString);
View user's profile
DTinAZ



Joined: 31 Mar 2009
Posts: 6

PostPosted: Thu Apr 01, 2010 12:34 pm Reply with quoteBack to top

Thanks for the solution--it also worked for me! Exactly one year ago, I posted this topic:

Was working before, but now it's not
http://www.feedforall.com/forum/viewtopic.php?p=18427

I would hope that the developers would kindly add the ampersand-spefic line to the XML parser file.

Peace,
DT
View user's profile
siroco1979



Joined: 27 Apr 2012
Posts: 13
Location: London

PostPosted: Sat Apr 28, 2012 7:17 pm Reply with quoteBack to top

Hi there,

I have just downloaded the rss2html script and I am having the same problem you guys have reported two years ago...

Code:

$errorCode = 26
xml_error_string() = Undeclared entity error
xml_get_current_line_number() = 10
xml_get_current_column_number() = 469
xml_get_current_byte_index() = 2570
 


I have already added to the FeedForAll_XMLParser.inc.php:
Code:
$XMLString = str_replace("&gt;",">", $XMLString);
$XMLString = str_replace("&lt;","<", $XMLString);
$XMLString = str_replace("&amp;","&", $XMLString);

I have read and reread this thread already a few times and cannot figure out what I am doing wrong or what it is missing.....

Any help? THanks!!

[/code]
View user's profileSend e-mail
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



View next topic
View previous topic


Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme