From: Daniel Harple Date: 2006-03-23T10:44:09+09:00 Subject: Re: bug in YAML for Ruby? On Mar 23, 2006, at 1:57 AM, 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? It is not a bug, but it is confusing. According the the YAML spec[1] numbers prefixed with a 0 signal an octal base (as does in Ruby). However 08 is not a valid octal number, so it doesn't get quoted. [1] http://yaml.org/type/int.html -- Daniel