How can I prevent duplicate encoding of html entities or fix them programmatically?
I am using the encode () function from the HTML :: Entities module to encode HTML objects in user input. The problem here is that we also allow users to enter HTML objects directly, and these entities end in double coding.
For example, a user may enter:
Stackoverflow & Perl = Awesome…
It ends with an encoding
Stackoverflow & Perl = Awesome…
This is displayed in the browser as
Stackoverflow & Perl = Awesome…
We want this to display as
Stackoverflow & Perl = Awesome...
Is there any way to prevent this double encoding? Or is there a module or piece of code that can easily fix these double-coding problems?
Any help is much appreciated!
source share