summaryrefslogtreecommitdiff
path: root/lib/rexml/source.rb
diff options
context:
space:
mode:
-rw-r--r--lib/rexml/source.rb14
1 files changed, 10 insertions, 4 deletions
@@ -59,6 +59,9 @@ module REXML
@to_utf = true
else
@to_utf = false
end
end
@@ -147,13 +150,13 @@ module REXML
str = @source.read( 2 )
if encoding
self.encoding = encoding
- elsif 0xfe == str[0] && 0xff == str[1]
@line_break = "\000>"
- elsif 0xff == str[0] && 0xfe == str[1]
@line_break = ">\000"
- elsif 0xef == str[0] && 0xbb == str[1]
str += @source.read(1)
- str = '' if (0xbf == str[2])
@line_break = ">"
else
@line_break = ">"
@@ -193,6 +196,9 @@ module REXML
str = @source.readline(@line_break)
str = decode(str) if @to_utf and str
@buffer << str
rescue Exception, NameError
@source = nil
end