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

Avoid double HTML entities / special characters encoding #14065

Open
dev-101 opened this Issue Feb 1, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@dev-101
Copy link

dev-101 commented Feb 1, 2019

Hi, if the page's <title> (in <head> section) contains for e.g. already encoded & character:

&#38;

or:

&amp;


M will encode it again, resulting in:

&amp;amp;

being displayed in the tooltip (but tooltip just copies values from <img> element)


which, again, will look like this in HTML:

&amp;

which is wrong.


It should simply be/look like this:

&

because it is already encoded HTML entity.

See screenshots for illustration.

matomo-html-char-encoding-bug-1
matomo-html-char-encoding-bug-2

@tsteur tsteur added this to the 3.10.0 milestone Feb 1, 2019

@tsteur

This comment has been minimized.

Copy link
Member

tsteur commented Feb 1, 2019

Cheers 👍

@fdellwing

This comment has been minimized.

Copy link
Contributor

fdellwing commented Feb 4, 2019

I guess the "fix" here would be to first decode it and then encode it again to make sure everything is fine?

@dev-101

This comment has been minimized.

Copy link
Author

dev-101 commented Feb 4, 2019

If I understand you correctly, just leave things stored in database as they are, and simply use htmlspecialchars_decode($title) for display purposes.

edit: I forgot that it does 2 times encoding, when it should use decoding.

@tsteur tsteur modified the milestones: 3.10.0, 3.9.0 Feb 4, 2019

@tsteur tsteur removed the Help wanted label Feb 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment