summaryrefslogtreecommitdiff
path: root/lib/rdoc/parser.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-24 07:39:37 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-24 07:39:37 +0000
commitdf3e22ce84c2b19de9833f3b642098ee5abd826a (patch)
treeac513707b2dfc108f844d6338dc5e1933d189819 /lib/rdoc/parser.rb
parent0f081edf7e2459dc22672cfa8f27c00fea5e24ad (diff)
Update rdoc-5.1.0
* Details of changes are following url. https://github.com/rdoc/rdoc/blob/master/History.rdoc#510--2017-02-24 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/parser.rb')
-rw-r--r--lib/rdoc/parser.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb
index 5abc374bf7..ead96b3f50 100644
--- a/lib/rdoc/parser.rb
+++ b/lib/rdoc/parser.rb
@@ -78,7 +78,7 @@ class RDoc::Parser
return true if s[0, 2] == Marshal.dump('')[0, 2] or s.index("\x00")
- mode = "r"
+ mode = 'r:utf-8' # default source encoding has been chagened to utf-8
s.sub!(/\A#!.*\n/, '') # assume shebang line isn't longer than 1024.
encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*([^\s;]+?)(?:-\*-|[\s;])/, 1]
mode = "rb:#{encoding}" if encoding
@@ -180,7 +180,9 @@ class RDoc::Parser
return nil if /coding:/i =~ type
type.downcase
- rescue ArgumentError # invalid byte sequence, etc.
+ rescue ArgumentError
+ rescue Encoding::InvalidByteSequenceError # invalid byte sequence
+
end
##