summaryrefslogtreecommitdiff
path: root/lib/rexml/encoding.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rexml/encoding.rb')
-rw-r--r--lib/rexml/encoding.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rexml/encoding.rb b/lib/rexml/encoding.rb
index e35c3acf7c..6cae6b644d 100644
--- a/lib/rexml/encoding.rb
+++ b/lib/rexml/encoding.rb
@@ -58,8 +58,8 @@ module REXML
# We have to recognize UTF-16, LSB UTF-16, and UTF-8
return UTF_16 if /\A\xfe\xff/n =~ str
return UNILE if /\A\xff\xfe/n =~ str
- str =~ /^\s*<?xml\s*version\s*=\s*(['"]).*?\2\s*encoding\s*=\s*(["'])(.*?)\2/um
- return $1.upcase if $1
+ str =~ /^\s*<\?xml\s+version\s*=\s*(['"]).*?\1\s+encoding\s*=\s*(["'])(.*?)\2/um
+ return $3.upcase if $3
return UTF_8
end
end