summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rexml/document.rb8
-rw-r--r--lib/rexml/xmldecl.rb6
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb
index 5508a60be4..f9fdbdaab3 100644
--- a/lib/rexml/document.rb
+++ b/lib/rexml/document.rb
@@ -145,8 +145,8 @@ module REXML
end
# :call-seq:
- # doc.write(output=$stdout, indent=-1, transtive=false, ie_hack=false)
- # doc.write(options={:output => $stdout, :indent => -1, :transtive => false, :ie_hack => false})
+ # doc.write(output=$stdout, indent=-1, transtive=false, ie_hack=false, encoding=nil)
+ # doc.write(options={:output => $stdout, :indent => -1, :transtive => false, :ie_hack => false, :encoding => nil})
#
# Write the XML tree out, optionally with indent. This writes out the
# entire XML document, including XML declarations, doctype declarations,
@@ -199,6 +199,10 @@ module REXML
# unable to parse proper XML, we have to provide a hack to generate XML
# that IE's limited abilities can handle. This hack inserts a space
# before the /> on empty tags. Defaults to false
+ # encoding::
+ # Encoding name as String. Change output encoding to specified encoding
+ # instead of encoding in XML declaration.
+ # Defaults to nil. It means encoding in XML declaration is used.
def write(*arguments)
if arguments.size == 1 and arguments[0].class == Hash
options = arguments[0]
diff --git a/lib/rexml/xmldecl.rb b/lib/rexml/xmldecl.rb
index 6b48a6f8ea..783c9233dc 100644
--- a/lib/rexml/xmldecl.rb
+++ b/lib/rexml/xmldecl.rb
@@ -44,11 +44,7 @@ module REXML
def write(writer, indent=-1, transitive=false, ie_hack=false)
return nil unless @writethis or writer.kind_of? Output
writer << START.sub(/\\/u, '')
- if writer.kind_of? Output
- writer << " #{content writer.encoding}"
- else
- writer << " #{content encoding}"
- end
+ writer << " #{content encoding}"
writer << STOP.sub(/\\/u, '')
end