ruby-1.9.1-p378 > a="José Saramago, 1922-2010"
=> "José Saramago, 1922-2010"
The old CGI module (RIP) could unescape these. Today REXML seems to be mode adequate. Here's a tip I picked up:
ruby-1.9.1-p378 > require 'rexml/document'
=> true
ruby-1.9.1-p378 > REXML::Text.unnormalize(a)
=> "José Saramago, 1922-2010"
ruby-1.9.1-p378 > REXML::Text.unnormalize(a).encoding
=> #<Encoding:UTF-8>
Props to the original posters.
No comments:
Post a Comment