unescapeHTML

S

Santi

Hi,

I need to decode escaped html entities but the following code is not
working:

--
require 'cgi'
print CGI.unescapeHTML('&eacute')
--

It prints "&eacute" insted of the expected e with the acute.

What's wrong?

Thank you.
 
C

ChrisH

Looking at the source, it doesn't seem to expect that particular code.
Infact it only handles <, >, " and &.
 
D

Dave Burt

Santi said:
Hi,

I need to decode escaped html entities but the following code is not
working:

--
require 'cgi'
print CGI.unescapeHTML('&eacute')
--

It prints "&eacute" insted of the expected e with the acute.

What's wrong?

CGI.unescapeHTML is designed to be the inverse of CGI.escapeHTML, which
is only designed to escape characters that are valid 7-bit ASCII but not
valid CDATA in HTML.

What do you want this for? You might have to build your own lookup table
to convert these into the character encoding you desire.

Cheers,
Dave
 

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
474,296
Messages
2,571,535
Members
48,281
Latest member
DaneLxa72

Latest Threads

Top