When creating a feed using Views > Format: RSS Feed, Show: Content, titles for items are encoded correctly. When creating a feed using Views > Format > Format: RSS Feed, Show: Fields, the titles for items are double encoded. For example:

RSS Feed - Content : <title>This title&#039;s apostrophe is rendered</title>
which correctly appears as "This title's apostrophe is rendered"

RSS Feed - Fields: <title>This title&amp;#039;s apostrophe is rendered</title> which incorrectly appears as "This title&#039;s apostrophe is rendered"

Double encoding occurs for apostrophes and ampersands. I have not tested other entities.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Charles Belov’s picture

Title: HTML entities in the item title are double encoded » HTML entities in the item title are double encoded for feeds using fields
Charles Belov’s picture

Using a temporary workaround.

Added the following file to our website's theme:

views-view-field--feed--title.tpl.php

with the code:

print preg_replace(array('/&quot;/', '/&amp;/', '/&#039;/'), array('"', '&', "'"), $output);

I understand that this is not exhaustive in terms of HTML entities, but it is sufficient for our use at the present time.

rooby’s picture

estebanhere’s picture

#2

Muchas gracias mi hermano, ese código me sirvio.

Thank you so much Charles Belov, that cod work for me!!

Arono974’s picture

#2 Thanks for the trick Charles Belov, you made my day !

didierlebouc’s picture

Please could you precise where exactly put this file or if anything needs to be added to the code.

I put the file named views-view-field--feed--title.tpl.php (see attachment) at sites/all/themes/NAME_of_my_theme directory and it doesn't work.

Thanks in advance.