Quirks with \0 in double quotes


#1

Are these bugs? This is ruby-1.8.4. The YAML spec seems to say “\0” is
legit.


require ‘yaml’

m = YAML.load(<<END)
a: 4
b: “\0\0”
c: 5
END

p m
puts

m = YAML.load(<<END)
a: 4

b: “\0\0\0\0\0\0\0\0\0\0\0\0\0”

b: 6
c: 5
END

p m
puts

begin
m = YAML.load(<<END)
a: 4
b: “\0”
c: 5
END
rescue => ex
p ex
puts ex.backtrace
end

END

Output:

{“a”=>4, “b”=>""}

{“a”=>4}

#<ArgumentError: syntax error on line 3, col 1: '> /usr/local/lib/ruby/1.8/yaml.rb:133:inload’
/usr/local/lib/ruby/1.8/yaml.rb:133:in `load’
-:23