From df3e22ce84c2b19de9833f3b642098ee5abd826a Mon Sep 17 00:00:00 2001 From: hsbt Date: Fri, 24 Feb 2017 07:39:37 +0000 Subject: 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 --- lib/rdoc/parser.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/rdoc/parser.rb') 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 ## -- cgit v1.2.3