Unescape result from inspect

how can i unescape the results from inspect method. I tried with URI but
not lucky :frowning:

x={“a”=>“aaaaaaaaaaaaaa”,“b”=>“ññññækkksdlæ[email protected]”}
puts URI.unescape(x.inspect)

On Fri, Oct 18, 2013 at 4:15 PM, Mario R. [email protected]
wrote:

how can i unescape the results from inspect method. I tried with URI but
not lucky :frowning:

x={“a”=>“aaaaaaaaaaaaaa”,“b”=>“[email protected]”}
puts URI.unescape(x.inspect)

Why do you expect that to work at all? URI escaping != #inspect format.

Cheers

robert

The problem is I have values escaped with inspect stored on Database and
later on I need to recover them and unescape them to be used… any
idea?

So… no possible to be unescaped?

Robert K. wrote in post #1124848:

On Fri, Oct 18, 2013 at 4:15 PM, Mario R. [email protected]
wrote:

On Tue, Oct 29, 2013 at 5:06 PM, Mario R. [email protected]
wrote:

The problem is I have values escaped with inspect stored on Database and
later on I need to recover them and unescape them to be used… any
idea?

The approach is broken: #inspect’s format is not intended for
serialization. You need to use a different mechanism to serialize
your objects into and out of the database:

  • Marshal (binary)
  • YAML (text)
  • some form of XML serialization
  • some form of JSON serialization

Cheers

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs