summaryrefslogtreecommitdiff
path: root/lib/rexml/parsers/baseparser.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rexml/parsers/baseparser.rb')
-rw-r--r--lib/rexml/parsers/baseparser.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb
index fc2354a67f..854e707fae 100644
--- a/lib/rexml/parsers/baseparser.rb
+++ b/lib/rexml/parsers/baseparser.rb
@@ -242,6 +242,11 @@ module REXML
@document_status = :after_doctype
@source.read if @source.buffer.size<2
md = @source.match(/\s*/um, true)
+ if @source.encoding == "UTF-8"
+ if @source.buffer.respond_to? :force_encoding
+ @source.buffer.force_encoding(Encoding::UTF_8)
+ end
+ end
end
end
if @document_status == :in_doctype