aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rexml/document.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rexml/document.rb')
-rw-r--r--lib/rexml/document.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb
index 6ac527fa83..5508a60be4 100644
--- a/lib/rexml/document.rb
+++ b/lib/rexml/document.rb
@@ -207,17 +207,19 @@ module REXML
indent = options[:indent]
transitive = options[:transitive]
ie_hack = options[:ie_hack]
+ encoding = options[:encoding]
else
- output, indent, transitive, ie_hack, = *arguments
+ output, indent, transitive, ie_hack, encoding, = *arguments
end
- output ||= $stdout
- indent ||= -1
+ output ||= $stdout
+ indent ||= -1
transitive = false if transitive.nil?
ie_hack = false if ie_hack.nil?
+ encoding ||= xml_decl.encoding
- if xml_decl.encoding != 'UTF-8' && !output.kind_of?(Output)
- output = Output.new( output, xml_decl.encoding )
+ if encoding != 'UTF-8' && !output.kind_of?(Output)
+ output = Output.new( output, encoding )
end
formatter = if indent > -1
if transitive