diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-03 05:42:40 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-03 05:42:40 +0000 |
commit | ac9a8ac62416cfc7c6faf059651b7945cb5e3bf6 (patch) | |
tree | 3418221eaae6f263b7698ba87aeeee08aae51540 /lib/rexml/output.rb | |
parent | 15a743b3ff393092f19fb8e57bd79675dd208b02 (diff) |
* lib/rexml/output.rb (REXML::Output): Don't output BOM in middle
of the output string.
* test/rexml/test_document.rb: Add a test for the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/output.rb')
-rw-r--r-- | lib/rexml/output.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/rexml/output.rb b/lib/rexml/output.rb index 50333ba177..208bb0ade1 100644 --- a/lib/rexml/output.rb +++ b/lib/rexml/output.rb @@ -11,6 +11,11 @@ module REXML self.encoding = encd @to_utf = encd != 'UTF-8' + + if encoding == "UTF-16" + @output << "\ufeff".encode("UTF-16BE") + self.encoding = "UTF-16BE" + end end def <<( content ) |