diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-28 22:08:56 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-28 22:08:56 +0000 |
commit | e2efe8e81dc7e9fce40b024df6a20bbf4b830350 (patch) | |
tree | 942e66e071e759c7db670a42daeac26c7437f25b /lib/rdoc/encoding.rb | |
parent | 90d5bcf9104fe58887cf705b718a9c7b537b51a5 (diff) | |
download | ruby-e2efe8e81dc7e9fce40b024df6a20bbf4b830350.tar.gz |
Import RDoc 3.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/encoding.rb')
-rw-r--r-- | lib/rdoc/encoding.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb index 4f0779881c..73ae505daf 100644 --- a/lib/rdoc/encoding.rb +++ b/lib/rdoc/encoding.rb @@ -60,8 +60,6 @@ module RDoc::Encoding # Sets the encoding of +string+ based on the magic comment def self.set_encoding string - return unless Object.const_defined? :Encoding - first_line = string[/\A(?:#!.*\n)?.*\n/] name = case first_line @@ -70,6 +68,10 @@ module RDoc::Encoding else return end + string.sub! first_line, '' + + return unless Object.const_defined? :Encoding + enc = Encoding.find name string.force_encoding enc if enc end |