aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rexml/xmldecl.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-02 15:36:48 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-02 15:36:48 +0000
commitf25ff846f6884e202d13ab28e3e10c917b9cdf31 (patch)
tree1912c745ed74d061e3213706184d63af6d7963a1 /lib/rexml/xmldecl.rb
parentcddcffb8f9dd015650b2ac02235bfe39261989f9 (diff)
downloadruby-f25ff846f6884e202d13ab28e3e10c917b9cdf31.tar.gz
* lib/rexml/encoding.rb (REXML::Encoding#encoding=): store @encoding
a String which means the name of the encoding. this partially revert r29646. * lib/rexml/document.rb: follow above. * lib/rexml/output.rb: ditto. * lib/rexml/parsers/baseparser.rb: ditto. * lib/rexml/source.rb: ditto. * lib/rexml/xmldecl.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/xmldecl.rb')
-rw-r--r--lib/rexml/xmldecl.rb13
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/rexml/xmldecl.rb b/lib/rexml/xmldecl.rb
index 81d3057732..361e4b7106 100644
--- a/lib/rexml/xmldecl.rb
+++ b/lib/rexml/xmldecl.rb
@@ -109,20 +109,9 @@ module REXML
end
private
- def normalized_encoding_name(_encoding)
- if _encoding == ::Encoding::UTF_16BE
- "UTF-16"
- else
- return _encoding.name
- end
- end
-
def content(enc)
rv = "version='#@version'"
- if @writeencoding || enc.to_s !~ /\Autf-8\z/i
- encoding_name = normalized_encoding_name(enc)
- rv << " encoding='#{encoding_name}'"
- end
+ rv << " encoding='#{enc}'" if @writeencoding || enc !~ /utf-8/i
rv << " standalone='#@standalone'" if @standalone
rv
end