T
Tom Payne
Hi all,
Normally I would expect that
YAML.load(x.to_yaml) == x
for all sensible values of x.
However, this does not seem to be the case if the string contains
certain new line characters, for example:
YAML.load("abc\r\n".to_yaml) # => "abc\n" ("\r" lost)
YAML.load("\r\n".to_yaml) # => "" ("\r\n" lost)
YAML.load("\n".to_yaml) # => "" ("\n" lost)
My question is: how can I configure YAML to preserve my line endings?
I'm using Ruby 1.8.4-preview2 and have Googled for a solution without
success. Note that the :UseBlock option to to_yaml does not help.
The reason that I need this functionality is that I would like to store
a string which includes a digital signature in a YAML document. Any
corruption of the line endings changes the string and consequently
invalidates the digital signature.
Thanks very much,
Normally I would expect that
YAML.load(x.to_yaml) == x
for all sensible values of x.
However, this does not seem to be the case if the string contains
certain new line characters, for example:
YAML.load("abc\r\n".to_yaml) # => "abc\n" ("\r" lost)
YAML.load("\r\n".to_yaml) # => "" ("\r\n" lost)
YAML.load("\n".to_yaml) # => "" ("\n" lost)
My question is: how can I configure YAML to preserve my line endings?
I'm using Ruby 1.8.4-preview2 and have Googled for a solution without
success. Note that the :UseBlock option to to_yaml does not help.
The reason that I need this functionality is that I would like to store
a string which includes a digital signature in a YAML document. Any
corruption of the line endings changes the string and consequently
invalidates the digital signature.
Thanks very much,