From: Jeff Schwab Date: 2009-02-21T01:19:45+09:00 Subject: Re: Un-escaping hexadecimal code I単aki Baz Castillo wrote: > string = "%61lice" > string = eval %{ "#{ string.gsub(/%/,'\x') }" } > => "alice" > > How could I avoid the usage of "eval" to un-escape the string? s.gsub! /%(\d+)/ do |match| $1.to_i(16).chr end puts s You might also consider supporting escaped % literals.