From eb92610a4c0c31616ac84ab56cb197db69e93a45 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 24 Dec 2007 16:44:39 +0000 Subject: * 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 --- lib/rdoc/rdoc.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') 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) -- cgit