summaryrefslogtreecommitdiff
path: root/lib/rexml/parseexception.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rexml/parseexception.rb')
-rw-r--r--lib/rexml/parseexception.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/rexml/parseexception.rb b/lib/rexml/parseexception.rb
index feb7a7e638..7b16cd1a41 100644
--- a/lib/rexml/parseexception.rb
+++ b/lib/rexml/parseexception.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: false
module REXML
class ParseException < RuntimeError
attr_accessor :source, :parser, :continued_exception
@@ -28,9 +29,9 @@ module REXML
err << "\nLine: #{line}\n"
err << "Position: #{position}\n"
err << "Last 80 unconsumed characters:\n"
- err << @source.buffer[0..80].gsub(/\n/, ' ')
+ err << @source.buffer[0..80].force_encoding("ASCII-8BIT").gsub(/\n/, ' ')
end
-
+
err
end
@@ -40,12 +41,12 @@ module REXML
end
def line
- @source.current_line[2] if @source and defined? @source.current_line and
+ @source.current_line[2] if @source and defined? @source.current_line and
@source.current_line
end
def context
@source.current_line
end
- end
+ end
end