From: "Iñaki Baz Castillo" Date: 2009-02-21T01:08:19+09:00 Subject: Re: Un-escaping hexadecimal code [SOLVED using CGI] El Viernes, 20 de Febrero de 2009, Iñaki Baz Castillo escribió: > Hi, I receive a String allowing hexadecimal escaping by using %XX syntax: > > %61lice => alice ( %61 == a ) > > I would like to un-escape the string. I've got it using "eval" but I'd > prefer avoiding using "eval": > > string = "%61lice" > string = eval %{ "#{ string.gsub(/%/,'\x') }" } > => "alice" > > How could I avoid the usage of "eval" to un-escape the string? Ops, it is easier than above. CGI lib already does it: require 'cgi' CGI.unescape("%61lice") => "alice" :) -- Iñaki Baz Castillo