Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
YAML modifies strings when it serializes them. What the crap?
$ ruby --version
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]
$ ruby yaml_bug.rb
YAML modifies strings when it serializes them!
Original: "1\n \n2"
Modified: "1\n\n2"
require 'yaml'
string = "1\n \n2"
modified_string = YAML.load(string.to_yaml)
if string == modified_string
puts "YAML does not modify strings when it serializes them."
else
puts "YAML modifies strings when it serializes them!"
puts "Original: #{string.inspect}"
puts "Modified: #{modified_string.inspect}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.