On Mar 22, 2006, at 7:57 PM, Matt R. wrote: > I'm getting some strange behavior with YAML in ruby regarding the > characters '08' in a hash. > > This code: > # > require 'yaml' > test = { "08" => '01', '01' => '08', '8' => '01' > } > File.open("test.yml", "w") {|f| YAML.dump(test, f)} > # > > produces this file: > --- > "01": 08 > "8": "01" > 08: "01" > > I do not understand why the 08s are not quoted. I tried it under ruby > 1.8.2 and 1.8.4. > > Is this expected? > > thanks, > -Matt > > -- > Posted via http://www.ruby-forum.com/. > Well just guessing here, but you don't have to quote 08 because it couldn't be an octal number anyway, so it must be a string. I don't know if this is why this happens or if this is what the YAML spec says but it makes sense to me, sorta.