Author |
Message |
p17blo
Regular


Joined: Jul 27, 2007
Posts: 77
|
Posted:
Wed Aug 22, 2007 2:22 pm |
|
In my final testing I believe I have founf a problem with backend.php
It maybe to do with the content of my news items but now when backend.php is called I end up with:
A Blank Feed Page when called from Firefox
An error as follows when called from IE7
"Internet Explorer cannot display this feed
This feed contains code errors. "
If I replace the file with the backend.php from NSN News then the RSS feed displays (albeit the links don't work due to the reworking in NSN News - I haven't installed the NSN News mod)
Now it gets really interesting.
If I replace backend.php with the PHP-NUKE dist file then it works fine with Firefox and I get the following error with IE7
"Internet Explorer cannot display this feed
Internet Explorer does not support feeds with DTDs. "
Anyway, I can fix the issue by modifying the NSN file, but the RN dist file has a lot of mods in it. I will see if I can track down where the problem is and post an update, but if anyone else has any ideas let me know
Paul |
|
|
|
 |
p17blo

|
Posted:
Wed Aug 22, 2007 3:23 pm |
|
Well here is my update on a resolution - According to feedvalidator.org my RN backend.php produces an RSS Feed that is
Quote: |
Message
XML Parsing error: syntax error
Explanation
Your feed is not well formed according to the XML specification. All feeds should be well-formed XML.
Solution
The text of the error may contain additional helpful details. At a minimum, the actual line and column number where the error was detected will be reported.
The most common cause is encoding errors. There are several basic approaches to solving this: escaping problematic characters, escaping entire blocks of text with CDATA sections, or putting an encoding declaration at the start of the feed.
Another common error is the inclusion of whitespace characters (spaces, tabs, newlines) before the XML Declaration. If an XML Declaration is included, it must be the first thing in the document
|
The error points to a <title> line with an unmodified & symbol.
Paul |
|
|
|
 |
Gremmie
Former Moderator in Good Standing

Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA
|
Posted:
Wed Aug 22, 2007 3:29 pm |
|
There are problems with the current implementation of backend.php and htmlentities. A better RSS feed generator is in the works. |
_________________ Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module |
|
|
 |
p17blo

|
Posted:
Wed Aug 22, 2007 3:32 pm |
|
Well sure enough, when I remove the & from the offending news item backend.php from RN works fine.
I can use a modified script for now and wait for the mentioned generator.
Paul |
|
|
|
 |
p17blo

|
Posted:
Thu Aug 23, 2007 10:15 am |
|
OK, well I have a fix for the problem.
Open backend.php
Find:
Code:
$title = entity_to_decimal_value(str_replace('_',' ',$title)); //added 9/1/2004
|
Add After
Code:
$title = preg_replace('/&(?!#[0-9]+;)/si', 'and', $title); //added 8/23/2007
|
This add MUST come after the first otherwise it all goes very wrong!
I have also created a new backend.php file, would anyone from RN like me to send it to them for consideration for the next release?
Paul |
|
|
|
 |
Gremmie

|
Posted:
Thu Aug 23, 2007 10:41 am |
|
But that replaces every entity with 'and'.....? There is already a conversion table in backend.php. You just have to run more stuff (like the title) through it.
IMHO, we need to stop storing htmlentitized text in the database. Just store plain text. And then format the text for the intended target, whether it is the screen or RSS feed, or whatever. Because they all can have different requirements. |
|
|
|
 |
p17blo

|
Posted:
Thu Aug 23, 2007 11:31 am |
|
Gremmie wrote: | But that replaces every entity with 'and'.....? There is already a conversion table in backend.php. You just have to run more stuff (like the title) through it. |
No it doesn't. That is why it is important to add it AFTER the existing conversion. The existing conversion converts entities to something else (I thing hex or dec or something). The only thing that is left after that conversion seems the be the single AMPERSAND (not the &) and the code I have added sweeps that up. Try it for yourself, it works believe me I have trying to fool it all afternoon
EDIT to add:- The title is already run through the converter, shown above!
Quote: |
IMHO, we need to stop storing htmlentitized text in the database. Just store plain text. And then format the text for the intended target, whether it is the screen or RSS feed, or whatever. Because they all can have different requirements. |
I agree with you on that. Store it in a unversal format in the DB then you can display it however it needs displaying.
For the moment though one line addition solves the immediate problem.
Paul |
|
|
|
 |
Gremmie

|
Posted:
Thu Aug 23, 2007 11:37 am |
|
Gotcha.
I'm still confused as to why XML doesn't like & or any &#ddd;. |
|
|
|
 |
|