I have following string saved in database:
<p>ampersand (&), bracket(<>), quotation marks (""'')</p>\r\n
I need to encode the special symbols and get a string
<p>ampersand (&), bracket(<>), quotation marks (""'')</p>
I used CGI library to encoding:
CGI::unescapeHTML("<p>ampersand (&), bracket(<>), quotation marks (""'')</p>\r\n")
the method returns "<p>ampersand (&), bracket(<>), quotation marks (\"\"'')</p>\r\n"
but should be
<p>ampersand (&), bracket(<>), quotation marks (""'')</p>
CodePudding user response:
It's actually correct (the method). It's returning what you want.
The \
you are seeing before the double quotes are just artifacts of rendering a string with embedded double quotes, so that they're not interpreted as the end of the string.