Hi all,

So in all my feeds, I'm getting html characters messing things up.

for example:

<title>It&#039;s National Animal Safety and Protection Month!</title>
<description>&lt;p&gt;Pet care tips and helpful info for animal lovers&lt;/p&gt;</description>

I've tried changing views_rss_views_fields.theme.inc line 88 from $row .= "<$key>". check_plain(htmlspecialchars_decode($value)) ."\n";}
to
$row .= "<$key>". check_plain(htmlspecialchars_decode($value, ENT_QUOTES)) ."\n";}

But there is no effect.

I do have php 5.2.11, so htmlspecialchars_decode() should work, and I did test the code by entering in a little character before the . The character did show up in the correct places. Does anyone have any idea what's wrong?

Thanks so much,
Evan

Comments

juc1’s picture

This problem is also mentioned in the views issues queue =

http://drupal.org/node/559056#comment-4349908

maciej.zgadzaj’s picture

Well, how I see it (at least in theory, haven't run any tests on it yet) is that this line should look like:

return "<$key>" . $value['#markup'] . "</$key>";

No htmlspecialchars_decode() here, no check_plain() either (note that check_plain() also calls htmlspecialchars(), hence some characters get double-encoded - see issue mentioned by Juc1).

Generally, I believe that output should be formatted in the way set up in view definition only, we shouldn't probably force any additional formatting here...

juc1’s picture

@ maciej - I tried something that didn't work so can you please clarify where your code in post #2 is supposed to go?

Also is this problem related to my problem ie html not being rendered in the feed?

Thank you

maciej.zgadzaj’s picture

StatusFileSize
new510 bytes

@Juc1 - as mentioned in issue description, this is a change to views/views_rss_views_fields.theme.inc file, in function template_preprocess_views_rss_fields_item() - see attached patch.

And yes, I'd say this is related to your problem too. However I suspect that in your case there could be even more to it, would need to see your original feed first though (how it looks before passing it through FeedBurner - would it be possible?)

Haven't released new dev version yet, as first I would want to play with it a little more and compare results of different configurations/outputs with other feeds (and validators), was a bit short on time recently though... Also, would be great to see how this patch works you as well?

juc1’s picture

@ Maciej, thanks for your reply. Here is a clone of the feed without feedburner = I don't think feedburner is causing the problem. I will report back re the result of the patch.

Thanks

juc1’s picture

StatusFileSize
new24.57 KB
new52.46 KB

@ Maciej

OK please see attached screen shot of the patched file =
patched file

Maybe I have done something wrong but a feed after this patch looks like this

feed

http://jurim.info/podcast/feedpatched

Thanks

juc1’s picture

StatusFileSize
new49.66 KB

view =

view

maciej.zgadzaj’s picture

Thanks Juc1. Actually, I wasn't suspecting FeedBurner to mess things up, I just wanted to check how the link is configured in your original feed.

Essentially, you shouldn't have any html links (<a href=""></a>) in the title element - link should be automatically generated by feed reader based on <link> element. So for example your most recent <item> should look something like this:

<item>
  <title>54 - Instant Gratification: the Cyrenaics</title>
  <link>http://historyofphilosophy.net/cyrenaics</link>
  ...
</item>

And links to MP3 files (or any other attachments) should go into <enclosure> element.

Re empty feed - looks strange. Patch works fine for me here, just tested it again. Example feed <item> element before patching:

<item>
  <title>test page</title>
  <description>&lt;p&gt;Example content&lt;/p&gt;</description>
  <link>&lt;a href=&quot;/content/test-page&quot;&gt;view&lt;/a&gt;</link>
</item>

and after:

<item>
  <title>test page</title>
  <description><p>Example content</p></description>
  <link><a href="/content/test-page">view</a></link>
</item>

Caches cleared? No other changes anywhere else? Have you checked if you still have everything ok in "Field usage" in in feed's "Style options"?

juc1’s picture

Ok sorry, it was a "field usage" thing. The bad news is that the patched feed doesn't seem to fix the html problem (re apostrophes etc) in Chrome = http://jurim.info/podcast/feedpatched.

In firefox and IE the feed won't display at all ("Internet Explorer cannot display this feed. This feed contains code errors.") I am not sure yet whether this is a separate problem.

Thanks...

maciej.zgadzaj’s picture

StatusFileSize
new558 bytes

Ok, scratch the previous patch. Had a quick look at RSS spec, and actually HTML entities should be there (well, in <description> element only, other elements should not contain any HTML in them).

New patch attached, I have also set up a simple test feed to check its results, and it seems to go fine through W3 validator (apart from namespace, but there is another issue for this), displays ok in Chrome/FF/IE, looks good in GReader and FeedBurner... so far so good.

juc1’s picture

OK thanks, with the new patch I can see that the apostrophe etc html problem is fixed in your feed and mine in IE and Firefox (although not in the xml = Chrome - but maybe that is normal??)

There is still the problem of my title links saying "a href=" http://jurim.info/podcast/feedpatched but if necessary I think one way to fix this is to just remove the link in 'link field to node'.

But there is another problem - the xml (chrome) correctly outputs my MP3 files, but in IE and firefox, the MP3 field is missing.

Any suggestions please?

Thank you

maciej.zgadzaj’s picture

Status: Active » Closed (duplicate)

Where do you see a problem with apostrophe in Chrome? Looking at it right now and looks ok to me...

Re title links - yes, that's what I said above - no HTML in any elements besides description.

Also, <link> element should point to article URL, not MP3 file. Any attached files should be put in <enclosure> tag, which is not supported by current version of the module I'm afraid - although there is already an issue for this with a patch available (haven't checked it yet though).

And well, we've gone through all of this only to just realize that I have already applied this change following on issue check_plain runs twice on title - so it's already in dev version for over a month... doh!

juc1’s picture

@ maciej, oh boy, sorry about the dev thing!

Any attached files should be put in tag, which is not supported by current version of the module I'm afraid

It seems that feedburner can take care of the enclosures for me =

http://feeds.feedburner.com/historyofphilosophy

3 fields = node title, node teaser, MP3 field - no problem with html thanks to your patch.

clone without feedburner =

http://historyofphilosophy.net/podcast/feed4nofb

Also,
element should point to article URL, not MP3 file.

My node titles link to the MP3 file rather than to the node - any suggestions for how to fix this please?

Thanks for your help...

maciej.zgadzaj’s picture

It's ok, it's my fault actually, I should have remembered doing this - but it was just a patch then, not a process like here, so it slipped my mind...

Anyway, re links - you cannot really change it right now if you want to keep your FireBurner's enclosures. I have already started (slowly) looking into categories and enclosures, so it will be there, sooner or later - just bear with me please...

juc1’s picture

ok thanks again for your help...

juc1’s picture

Issue summary: View changes

php version pointed