如何使用GCI转换字符串:unescape?

时间:2013-08-08 16:45:03

标签: ruby-on-rails ruby string character

字符串是:

"Hugo S%C3%A1nchez"

当我尝试解码时,它显示为:

irb(main):016:0> CGI.escapeHTML('Hugo S%C3%A1nchez')
=> "Hugo S%C3%A1nchez"

我应该如何使它看起来像Hugo Sánchez

1 个答案:

答案 0 :(得分:1)

使用CGI.unescape

CGI.unescape "Hugo S%C3%A1nchez" # => "Hugo S\u00E1nchez"