Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Pege Paal
Encoding option does not work [ reply ]  
2009-09-24 12:25
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?