CGI unescapeHTML to escape code '&# 8211;'

  • Thread starter Shashank Agarwal
  • Start date
S

Shashank Agarwal

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?
 
A

Axel Etzold

-------- Original-Nachricht --------
Datum: Mon, 8 Sep 2008 01:45:44 +0900
Von: Shashank Agarwal <[email protected]>
An: (e-mail address removed)
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?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top