How to convert the HTML entities into UTF-8 character set, in ruby 1.8.7

Hi,

Is there away to convert the HTML entities into UTF-8 character set, in ruby 1.8.7?

(For example, if we consider “ö”, convert the entity number “ö” into “\303\266”. Or at least converting the html entity to the character “ö” )

Thank you

CGI.unescapeHTML may do what you’re looking for.

–Matt Jones

Here's what I do:

coder = HTMLEntities.new
foo = coder.decode(foo)

I tried CGI.unescapeHTML and hit some problems, but that might have been my source talking, since there were also custom entities declared in XML.

Walter

Thanks alot for the responses. Could do it using HTMLEntities.