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/.

-------- Original-Nachricht --------

Datum: Mon, 8 Sep 2008 01:45:44 +0900
Von: Shashank Agarwal <shashank_hi@yahoo.com>
An: ruby-talk@ruby-lang.org
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

···

--
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!

Axel Etzold 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. :slight_smile:

···

--
Posted via http://www.ruby-forum.com/\.