Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS feed title showing HMTL code #39004

Open
jikometrix opened this issue Oct 20, 2022 · 7 comments
Open

RSS feed title showing HMTL code #39004

jikometrix opened this issue Oct 20, 2022 · 7 comments

Comments

@jikometrix
Copy link

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

@brianteeman
Copy link
Contributor

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

@brianteeman
Copy link
Contributor

I believe that the line of code is

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

@jikometrix
Copy link
Author

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.

@jikometrix
Copy link
Author

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

@Hackwar Hackwar added the bug label Feb 22, 2023
@brianteeman
Copy link
Contributor

brianteeman commented Feb 27, 2023

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

@Fedik
Copy link
Member

Fedik commented Feb 27, 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')

@brianteeman
Copy link
Contributor

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');

@Hackwar Hackwar added the PBF Pizza, Bugs and Fun label Aug 25, 2023
@brianteeman brianteeman removed the PBF Pizza, Bugs and Fun label Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants