The encoding option does nothing when creating new XML document from string. This code:
require 'rubygems'
require 'xml'
xml_string = "<node1>test</node1>"
puts XML::Document.string(xml_string, :encoding => XML::Encoding::ISO_8859_1).to_s
displays this result:
<?xml version="1.0" encoding="UTF-8"?>
<node1>test</node1>
No matter what the :encoding option is, the XML encoding is always UTF-8, what's going on?
|