user2376068
user2376068

Reputation: 207

How do I convert strings using GCI:unescape?

The string is:

"Hugo S%C3%A1nchez"

When I try to decode it it shows as:

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

How should I make it work so it looks like Hugo Sánchez?

Upvotes: 0

Views: 94

Answers (1)

falsetru
falsetru

Reputation: 369284

Use CGI.unescape:

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

Upvotes: 1

Related Questions