[前][次][番号順一覧][スレッド一覧]

ruby-changes:22790

From: tenderlove <ko1@a...>
Date: Tue, 28 Feb 2012 10:30:56 +0900 (JST)
Subject: [ruby-changes:22790] tenderlove:r34839 (trunk): * ext/psych/lib/psych.rb: default open YAML files with utf8 external

tenderlove	2012-02-28 10:30:15 +0900 (Tue, 28 Feb 2012)

  New Revision: 34839

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34839

  Log:
    * ext/psych/lib/psych.rb: default open YAML files with utf8 external
      encoding. [ruby-core:42967]
    * test/psych/test_tainted.rb: ditto

  Modified files:
    trunk/ChangeLog
    trunk/ext/psych/lib/psych.rb
    trunk/test/psych/test_tainted.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34838)
+++ ChangeLog	(revision 34839)
@@ -1,3 +1,9 @@
+Tue Feb 28 10:28:51 2012  Aaron Patterson <aaron@t...>
+
+	* ext/psych/lib/psych.rb: default open YAML files with utf8 external
+	  encoding. [ruby-core:42967]
+	* test/psych/test_tainted.rb: ditto
+
 Mon Feb 27 23:46:09 2012  Yukihiro Matsumoto  <matz@r...>
 
 	* parse.y (opt_bv_decl): allow newline at the end.  [ruby-dev:45292]
Index: ext/psych/lib/psych.rb
===================================================================
--- ext/psych/lib/psych.rb	(revision 34838)
+++ ext/psych/lib/psych.rb	(revision 34839)
@@ -156,7 +156,7 @@
   #
   # 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 @@
   # 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:
Index: test/psych/test_tainted.rb
===================================================================
--- test/psych/test_tainted.rb	(revision 34838)
+++ test/psych/test_tainted.rb	(revision 34839)
@@ -121,7 +121,7 @@
       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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]