Project

General

Profile

Backport #4385

YAML encoding error

Added by sand (Andrey Stikheev) over 8 years ago. Updated 7 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
[ruby-core:35165]

Description

=begin
I'm found a strange behavior of YAML in ruby 1.8.7 on simple string:

ruby-1.8.7-p330 :002 > require 'yaml'
=> true
ruby-1.8.7-p330 :003 > YAML::load("\n {\n}".to_yaml)
ArgumentError: syntax error on line 3, col 0: }'
from /Users/sand/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/yaml.rb:133:in
load'
from /Users/sand/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/yaml.rb:133:in `load'
from (irb):3

In ruby 1.9.2 seems to be all fine:

ruby-1.9.2-head :011 > require 'yaml'
=> true
ruby-1.9.2-head :012 > YAML::load("\n {\n}".to_yaml)
=> "\n {\n}"

Encoding results:

ruby-1.9.2-head :002 > "\n {\n}".to_yaml
=> "--- \"\n {\n\\n}\"\n"

ruby-1.8.7-p330 :002 > "\n {\n}".to_yaml
=> "--- |-\n\n {\n}\n"

I'm check this on Mac OS and FreeBSD:

Darwin 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386
FreeBSD 8.0-STABLE FreeBSD 8.0-STABLE
=end

History

#1

Updated by jeremyevans0 (Jeremy Evans) 7 days ago

  • ruby -v deleted (ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10.6.0])
  • Target version deleted (Ruby 1.8.7)
  • Status changed from Open to Closed
  • Description updated (diff)
  • Project changed from Ruby 1.8 to Backport187
  • Tracker changed from Bug to Backport

Also available in: Atom PDF