[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

YAML Broken?

David Pollak

7/25/2006 9:40:00 PM

Folks,

It seems that when I YAML.dump arrays that contain long strings that
contain non-printables and sometimes UTF-8 sequences, the YAML'ed
objects can't be read back in. Is this a known issue? If so, is
there a known work-around? Alternatively, are there any other ways to
serialize objects (JSON doesn't work because eval() barfs on very long
strings)?

Thanks,

David


--
--------
David Pollak's Ruby Playground
http://d...

5 Answers

Justin Collins

7/25/2006 9:58:00 PM

0

David Pollak wrote:
> Folks,
>
> It seems that when I YAML.dump arrays that contain long strings that
> contain non-printables and sometimes UTF-8 sequences, the YAML'ed
> objects can't be read back in. Is this a known issue? If so, is
> there a known work-around? Alternatively, are there any other ways to
> serialize objects (JSON doesn't work because eval() barfs on very long
> strings)?
>
> Thanks,
>
> David
>
>
There's always Marshal.

http://ruby-doc.org/core/classes/Ma...

-Justin

Ara.T.Howard

7/25/2006 10:04:00 PM

0

David Pollak

7/25/2006 10:14:00 PM

0

Thanks!

On 7/25/06, Justin Collins <collinsj@seattleu.edu> wrote:
> David Pollak wrote:
> > Folks,
> >
> > It seems that when I YAML.dump arrays that contain long strings that
> > contain non-printables and sometimes UTF-8 sequences, the YAML'ed
> > objects can't be read back in. Is this a known issue? If so, is
> > there a known work-around? Alternatively, are there any other ways to
> > serialize objects (JSON doesn't work because eval() barfs on very long
> > strings)?
> >
> > Thanks,
> >
> > David
> >
> >
> There's always Marshal.
>
> http://ruby-doc.org/core/classes/Ma...
>
> -Justin
>
>


--
--------
David Pollak's Ruby Playground
http://d...

Alex Young

7/25/2006 11:53:00 PM

0

David Pollak wrote:
> Folks,
>
> It seems that when I YAML.dump arrays that contain long strings that
> contain non-printables and sometimes UTF-8 sequences, the YAML'ed
> objects can't be read back in. Is this a known issue? If so, is
> there a known work-around? Alternatively, are there any other ways to
> serialize objects (JSON doesn't work because eval() barfs on very long
> strings)?
If you're on Windows, check you're reading and writing in binary mode...
Not sure if that's what'll be causing your problem, but it's tripped
me up before.

--
Alex

Paul Battley

7/26/2006 8:18:00 AM

0

On 25/07/06, David Pollak <pollak@gmail.com> wrote:
> It seems that when I YAML.dump arrays that contain long strings that
> contain non-printables and sometimes UTF-8 sequences, the YAML'ed
> objects can't be read back in. Is this a known issue? If so, is
> there a known work-around? Alternatively, are there any other ways to
> serialize objects (JSON doesn't work because eval() barfs on very long
> strings)?

Are you using 1.8.4? I was bitten by this in Ruby 1.8.2, and actually
managed to track it down to a specific combination (when a hash key
was a string containing both 0x00 and 0x0A in a non-final position).
That specific bug seems to be fixed in 1.8.4, however.

Paul.