summaryrefslogtreecommitdiff
path: root/lib/rdoc/rdoc.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/rdoc.rb')
-rw-r--r--lib/rdoc/rdoc.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index ce1cb1a93f3..9ddece89e0b 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -209,8 +209,8 @@ module RDoc
File.read filename
end
- if defined? Encoding then
- if /coding:\s*(\S+)/ =~ content[/\A(?:.*\n){0,2}/]
+ if defined?(::Encoding) then
+ if /coding[=:]\s*([^\s;]+)/ =~ content[/\A(?:!.*\n)?(.*\n)/, 1]
if enc = ::Encoding.find($1)
content.force_encoding(enc)
end