No Code Attached Yet bug
avatar jikometrix
jikometrix
20 Oct 2022

Steps to reproduce the issue

How can I get the Joomla 4 RSS to render single quotes as single quotes in the RSS feed? I get this ' instead of a single quote.

As a result the email notices of the RSS feed also show this oddity.

Create article with single quote in title then save and view RSS

Expected result

The Feed should read. "<title>You Know You're Different - How Can You Prove It?</title>"

Actual result

RSS feed tile says, "<title>You Know You&#39;re Different - How Can You Prove It?</title>"

System information (as much as possible)

See attached TXT file

Additional comments

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar jikometrix jikometrix - open - 20 Oct 2022
avatar jikometrix jikometrix - change - 20 Oct 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 20 Oct 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Oct 2022
avatar brianteeman
brianteeman - comment - 3 Nov 2022

I wasn't sure if you meant the RSS title or the RSS Item Title so I tried both

image

image

As can be seen the problem is on the item title only.

Hope that helps someone debug this

avatar brianteeman
brianteeman - comment - 3 Nov 2022

I believe that the line of code is

$feed .= " <title>" . htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8') . "</title>\n";

avatar jikometrix
jikometrix - comment - 3 Nov 2022

I think you are correct. How do we get the output to be a single quote for the feed though. I can see the htmlspecialchars is doing its job.

avatar jikometrix
jikometrix - comment - 18 Nov 2022

Do you have any thoughts on how to render character correctly for Feed?

avatar Hackwar Hackwar - change - 22 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 22 Feb 2023
avatar brianteeman
brianteeman - comment - 27 Feb 2023

I can no longer replicate this error - perhaps it was solved elsewhere?

avatar Fedik
Fedik - comment - 27 Feb 2023

Can you please try to test this with:

htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT | ENT_XML1, 'UTF-8')

Or just:

htmlspecialchars(strip_tags($data->items[$i]->title),  ENT_XML1, 'UTF-8')
avatar brianteeman
brianteeman - comment - 27 Feb 2023

The problem is that there are two different sets of code that is used for sanitizing the title.

If its a blog or list category then it uses

// Strip html from feed item title
if ($titleField) {
$title = $this->escape($item->$titleField);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');

But if it is features articles (or some of the other components) then it uses

// Strip html from feed item title
$title = htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8');
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');

avatar Hackwar Hackwar - change - 25 Aug 2023
Labels Added: PBF
avatar Hackwar Hackwar - labeled - 25 Aug 2023
avatar brianteeman brianteeman - change - 1 Sep 2023
Labels Removed: PBF
avatar brianteeman brianteeman - unlabeled - 1 Sep 2023

Add a Comment

Login with GitHub to post a comment