diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-28 01:30:15 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-28 01:30:15 +0000 |
commit | 0cb987bc514495c99c3f5c3ee373594507d1c115 (patch) | |
tree | b520b5de3c875c52b85b0d8aabcffa94fb0e059a /ext/psych | |
parent | 58fb7e9151dfd749832ab4edee0a2380cebaa906 (diff) |
* ext/psych/lib/psych.rb: default open YAML files with utf8 external
encoding. [ruby-core:42967]
* test/psych/test_tainted.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych')
-rw-r--r-- | ext/psych/lib/psych.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb index 3b7f9a34f2..cb5c4a5cf3 100644 --- a/ext/psych/lib/psych.rb +++ b/ext/psych/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: |