I’m reading an XML file that has the html codes for hyphens and stuff
like that. I tried escaping hyphen’s html code, which is ‘&# 8211;’
(space added to avoid interpretation) with the CGI::unescapeHTML
function. But it did not escape it. Is there a way to escape such codes?
-------- Original-Nachricht --------
Datum: Mon, 8 Sep 2008 01:45:44 +0900
Von: Shashank A. [email protected]
An: [email protected]
Betreff: CGI unescapeHTML to escape code '&# 8211;'
I’m reading an XML file that has the html codes for hyphens and stuff
like that. I tried escaping hyphen’s html code, which is ‘&# 8211;’
(space added to avoid interpretation) with the CGI::unescapeHTML
function. But it did not escape it. Is there a way to escape such codes?Posted via http://www.ruby-forum.com/.
Dear Shashank,
have a look at htmlentites (http://htmlentities.rubyforge.org/).
Maybe you can re-escape its results using CGI.escape, if that’s needed.
Best regards,
Axel
Axel E. wrote:
Dear Shashank,
have a look at htmlentites (http://htmlentities.rubyforge.org/).
Maybe you can re-escape its results using CGI.escape, if that’s needed.Best regards,
Axel
Thanks, this is what I was looking for.