[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

marshal question

Christophe Mckeon

12/18/2007 11:22:00 PM

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
--
Posted via http://www.ruby-....

1 Answer

Joel VanderWerf

12/18/2007 11:38:00 PM

0

Christophe Mckeon 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"

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407