1
Vote

YAML.dump creates broken data

description

When I YAML.dump a hash which contains only of an entry where the value is a long string with spaces,
the created yaml contains a linebreak and is not loadable anymore with Yaml.
 
Example:
 
aHash1= { :one => "One Two Three For Five Six Seven Eight Nine Ten Eleven Twelve 13 14 15 16 17 18 19 20 21 22" }
 
Results in

 

:one: One Two Three For Five Six Seven Eight Nine Ten Eleven Twelve 13 14 15 16 17
18 19 20 21 22
 
If I use YAML.load I get
 
iryamltest.ir:6:in `load': while scanning a block mapping: expected <block end>, but found: #<ScalarToken Value="18 19 20 21 22" Style="None"> (line 4, column 1) (ArgumentError)
    from iryamltest.ir:6
 
Tested with IronRuby 1.0 and 1.1.

file attachments

comments

mrzed wrote Aug 19, 2010 at 9:36 AM

BTW: The problem vanishes as soon as there are no spaces in the string.

wrote Jul 28, 2011 at 8:01 PM

wrote Feb 21, 2013 at 11:39 PM

iulianfecioru wrote Jan 27, 2015 at 9:20 AM

DONE (pending for push to master)