Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* ext/psych/lib/psych.rb: default open YAML files with utf8 external

  encoding. [ruby-core:42967]
* test/psych/test_tainted.rb: ditto
  • Loading branch information...
commit 99b46899732b32d5ab08b82bcba03f276a281f4f 1 parent 3ef54d1
@tenderlove authored
Showing with 9 additions and 3 deletions.
  1. +6 −0 CHANGELOG.rdoc
  2. +2 −2 lib/psych.rb
  3. +1 −1  test/psych/test_tainted.rb
View
6 CHANGELOG.rdoc
@@ -1,3 +1,9 @@
+Tue Feb 28 10:28:51 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: default open YAML files with utf8 external
+ encoding. [ruby-core:42967]
+ * test/psych/test_tainted.rb: ditto
+
Fri Feb 24 13:54:33 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/parser.c: prevent a memory leak by protecting calls to
View
4 lib/psych.rb
@@ -156,7 +156,7 @@ def self.parse yaml, filename = nil
#
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
def self.parse_file filename
- File.open filename do |f|
+ File.open filename, 'r:bom|utf-8' do |f|
parse f, filename
end
end
@@ -264,7 +264,7 @@ def self.load_stream yaml, filename = nil
# Load the document contained in +filename+. Returns the yaml contained in
# +filename+ as a ruby object
def self.load_file filename
- File.open(filename) { |f| self.load f, filename }
+ File.open(filename, 'r:bom|utf-8') { |f| self.load f, filename }
end
# :stopdoc:
View
2  test/psych/test_tainted.rb
@@ -121,7 +121,7 @@ def assert_taintedness string
t.binmode
t.write string
t.close
- File.open(t.path) { |f|
+ File.open(t.path, 'r:bom|utf-8') { |f|
@parser.parse f
}
t.close(true)
Please sign in to comment.
Something went wrong with that request. Please try again.