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 | eb92610a4c0c31616ac84ab56cb197db69e93a45 (patch) | |
| tree | 7614235b37658cd157dc9c3a05b33d1c7a3813a9 /lib/rdoc | |
| parent | b9ce5706b5b7d53868f1d76010d269e80f246a9a (diff) | |
| download | ruby-eb92610a4c0c31616ac84ab56cb197db69e93a45.tar.gz ruby-eb92610a4c0c31616ac84ab56cb197db69e93a45.tar.xz ruby-eb92610a4c0c31616ac84ab56cb197db69e93a45.zip | |
* lib/rdoc/rdoc.rb (parse_files): interpret coding cookie.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc')
| -rw-r--r-- | lib/rdoc/rdoc.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index af4a822da..51038a165 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) |
