summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-03-05 09:26:13 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-03-05 09:26:13 -0800
commit99b46899732b32d5ab08b82bcba03f276a281f4f (patch)
tree8414c3fe51da15d6311531e5bff9db8da7295cee /lib
parent3ef54d1b36bfec75f0eb6c9de8c9cb5e71d25bcd (diff)
downloadpsych-99b46899732b32d5ab08b82bcba03f276a281f4f.zip
* ext/psych/lib/psych.rb: default open YAML files with utf8 external
encoding. [ruby-core:42967] * test/psych/test_tainted.rb: ditto
Diffstat (limited to 'lib')
-rw-r--r--lib/psych.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/psych.rb b/lib/psych.rb
index 3b7f9a3..cb5c4a5 100644
--- a/lib/psych.rb
+++ b/lib/psych.rb
@@ -156,7 +156,7 @@ module Psych
#
# 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 @@ module Psych
# 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: