So, I have this UTF-8 line in an XML file:
Horrible place. ☠☠☠
And when I pass it to an external application, funny characters are returned as XML objects:
Horrible place. ☠☠☠
In Ruby, how do I convert this string back to UTF-8? This is probably a really simple solution, but I can't find anything in standard libraries; eg. CGI.unescapeHTML(which work well for things like >) seem to completely ignore them.
ree-1.8.7-2010.02 > CGI.unescapeHTML('>')
=> ">"
ree-1.8.7-2010.02 > CGI.unescapeHTML('☠')
=> "☠"
source
share