Marshal question

hi,

is there some character or sequence of characters which is guaranteed
not to occur in a string produced by Marshal.dump on some arbitrary
object hierarchy.

thanks,
_c

Christophe M. wrote:

hi,

is there some character or sequence of characters which is guaranteed
not to occur in a string produced by Marshal.dump on some arbitrary
object hierarchy.

Think not. If you do:

result = Marshal.dump(some_sequence_of_characters)

then the characters of the string some_sequence_of_characters are going
to be embedded in the result string.

For example:

irb(main):001:0> Marshal.dump(“1234”)
=> “\004\b”\t1234"
irb(main):002:0> Marshal.dump("\001\002\003\004")
=> “\004\b”\t\001\002\003\004"

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