diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-24 16:44:39 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-24 16:44:39 +0000 |
| commit | 8db7c837f9bf69ca0264190f36e78cd5d6b12f84 (patch) | |
| tree | 7614235b37658cd157dc9c3a05b33d1c7a3813a9 | |
| parent | 6ca558d6ab8e2553b32a415537c484bffd9b189c (diff) | |
* lib/rdoc/rdoc.rb (parse_files): interpret coding cookie.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | lib/rdoc/rdoc.rb | 5 |
2 files changed, 9 insertions, 0 deletions
@@ -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) |
