summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--lib/rdoc/rdoc.rb5
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 6b1eeed566..45fa1f4897 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Dec 25 01:42:41 2007 Tanaka Akira <akr@fsij.org>
+
+ * lib/rdoc/rdoc.rb (parse_files): interpret coding cookie.
+
Tue Dec 25 01:38:04 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* proc.c (method_name): preserve Symbol's encoding.
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index af4a822da1..51038a1652 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -220,6 +220,11 @@ module RDoc
$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)