From: Charles Oliver Nutter Date: 2010-08-20T08:34:42+09:00 Subject: Re: YAML Bug - can't round-trip a hash value with leading newlines. Please file a bug if you could, at http://bugs.jruby.org :) On Mon, Aug 16, 2010 at 12:14 AM, Daniel Sheppard wrote: > YAML can't round-trip the hash: {"default"=>"\r\n  Monkey \r\nX"}. > > Shouldn't yaml use the escaped string format for any string that starts with whitespace, ie, > > yaml = "--- \ndefault: \"\\r\\n  Monkey \\r\\nX\"" > p YAML.load(yaml) > => {"default"=>"\r\n  Monkey \r\nX"} > > Below is a demonstration of this: > > ruby <<-EOF > hash = {"default"=>"\r\n  Monkey \r\nX"} > yaml = YAML.dump(hash) > p yaml > hash2 = YAML.load(yaml) > EOF > "--- \ndefault: |-\n  \r\n    Monkey\r\n  \r\n  

Contact us

\n" > /usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 4, col 2: `  X' (ArgumentError) >        from /usr/lib/ruby/1.8/yaml.rb:133:in `load' >        from -:4 > > ruby -v > ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux] > > > Same bug exists in the jruby implementation as well. > >