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

ruby-changes:3129

From: ko1@a...
Date: 25 Dec 2007 01:44:54 +0900
Subject: [ruby-changes:3129] akr - Ruby:r14621 (trunk): * lib/rdoc/rdoc.rb (parse_files): interpret coding cookie.

akr	2007-12-25 01:44:39 +0900 (Tue, 25 Dec 2007)

  New Revision: 14621

  Modified files:
    trunk/ChangeLog
    trunk/lib/rdoc/rdoc.rb

  Log:
    * lib/rdoc/rdoc.rb (parse_files): interpret coding cookie.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14621&r2=14620
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rdoc/rdoc.rb?r1=14621&r2=14620

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14620)
+++ ChangeLog	(revision 14621)
@@ -1,3 +1,7 @@
+Tue Dec 25 01:42:41 2007  Tanaka Akira  <akr@f...>
+
+	* lib/rdoc/rdoc.rb (parse_files): interpret coding cookie.
+
 Tue Dec 25 01:38:04 2007  Yukihiro Matsumoto  <matz@r...>
 
 	* proc.c (method_name): preserve Symbol's encoding.
Index: lib/rdoc/rdoc.rb
===================================================================
--- lib/rdoc/rdoc.rb	(revision 14620)
+++ lib/rdoc/rdoc.rb	(revision 14621)
@@ -220,6 +220,11 @@
         $stderr.printf("\n%35s: ", File.basename(fn)) unless options.quiet
         
         content = File.open(fn, "r") {|f| f.read}
+        if /coding:\s*(\S+)/ =~ content[/\A(?:.*\n){0,2}/]
+          if enc = Encoding.find($1)
+            content.force_encoding(enc)
+          end
+        end
 
         top_level = TopLevel.new(fn)
         parser = ParserFactory.parser_for(top_level, fn, content, options, @stats)

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

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