For some reason check_plain() gets run twice over the title. Causing html entities to show in the rendered ouput.
I personally fixed it by changing this bit of code:

  foreach ($item as $key => $value) {
    if ($value) {
    	if($key == 'title') {
    		$row .= "<$key>". $value ."</$key>\n";
    	}
      	else {
      		$row .= "<$key>". check_plain($value) ."</$key>\n";
      	}
    }
  }
CommentFileSizeAuthor
#12 ent_quotes-779760-10.patch558 bytestrisketonni
#3 779760_3.patch691 bytesDavid Goode

Comments

chrisdfeld’s picture

I encountered the same problem with 6.x-1.0-beta4. I'd consider this a top-priority fix since it results in mangled feed item titles.

TCRobbert's code above replaces views_rss_views_fields.theme.inc lines 68 through 72 FYI.

bgibson-glu’s picture

I had the same problem - edit above appears to have fixed it.

David Goode’s picture

Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new691 bytes

The problem isn't with the title field persay, but with the node title field handler, which does check_plain automatically on render. This could affect anything, including description, for instance. I have attached a "fix" which does htmlspecialchars_decode and then check_plain's. An ideal fix would involve PHP 5.2's option to htmlspecialchars which doesn't allow double encoding...not supported for lower versions though. This is probably a reasonable fix and RTBC, no much better way of doing it that I see. Thanks for the find.

David Goode’s picture

Status: Needs review » Fixed

Previous patch committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

bgibson-glu’s picture

After upgrading to beta5 this issue has reappeared - my title field is outputting html entities (see http://www.glu.org/en/feeds/ais).

I never installed the patch, just used the code in the original post. Thoughts on what might be happening?

bgibson-glu’s picture

Status: Closed (fixed) » Active
ranganathsm’s picture

Version: 6.x-1.0-beta4 » 6.x-1.0-beta5

Even I am having the same problem. I downloaded the latest beta5 and still the titles and teasers have the html special characters.

Anybody has a solution for this?

jordanshirkey’s picture

I was experiencing this issue with 1.0-beta5. My quick solution was just to copy the template_preprocess_views_rss_fields_item() function from views_rss_views_fields.theme.inc in to my theme's template.php and then rename and modify it in a similar fashion to TCRobbert's code above:

/**
 * Template preprocessor for views-rss-fields-item.tpl.php.
 */
function theme_preprocess_views_rss_fields_item(&$vars) {
  $item = $vars['item'];

  // Loop through key=>value pairs
  $row = '';
  foreach ($item as $key => $value) {
    if ($value) {
      if ($key == 'title') {
        $row .= "<$key>" . $value . "</$key>\n";
      }
      else {
        $row .= "<$key>". check_plain(htmlspecialchars_decode($value)) ."</$key>\n";
      }
    }
  }

  $vars['row'] = $row;
}
icosa’s picture

I think David's patch works well except that by default, htmlspecialchars_decode() doesn't decode single quotes so I was getting & #039; in my titles.

Adding the ENT_QUOTES parameter fixes that.

$row .= "<$key>". check_plain(htmlspecialchars_decode($value, ENT_QUOTES)) ."</$key>\n";
aaronelborg’s picture

icosa's fix to David's patch fixes the issue for me.

thanks, icosa and David!

trisketonni’s picture

StatusFileSize
new558 bytes

I have created a new patch with the changes you submitted. It was very helpful.

Thanks a lot!

arski’s picture

Version: 6.x-1.0-beta5 » 6.x-1.x-dev
Status: Active » Needs review

works perfectly for me - are there still any potential issues with that or can we mark this as tested and get it committed?

sirkitree’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #12 worked for me.

maciej.zgadzaj’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Fix #10 (patch #12) committed to 6.x-1.x-dev.