From: Diana Jaunzeikare Date: 2009-08-11T01:41:00+09:00 Subject: Libxml: trying to set encoding for a document --000e0cd2be3e2b4a580470cc4020 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi all! I have problems with setting encoding for an xml file. I want to produce an xml file which starts with I tried the following code, but it gives initialized constant error when I try to set up document.encoding. require 'xml' d = XML::Document.new() #d.encoding = XML::Encoding::UTF_8 #=> uninitialized constant LibXML::XML::Encoding (NameError) d.root = XML::Node.new('node') d.root << "Some info" d.save('test.xml', true) produces: Some info I tried to set encoding when saving the document, as shown in documentation, but without luck. #d.save('test.xml', :indent => true, :encoding => 'UTF-8') #=>The second parameter (format) must be true or false (ArgumentError) #d.save('test.xml', :indent => true, :encoding => XML::Encoding::UTF_8) #=> The second parameter (format) must be true or false (ArgumentError) I checked ruby-libxml bug tracker and such bug has not been reported. So I am wondering if I am doing something wrong, or its a bug. Thanks, Diana --000e0cd2be3e2b4a580470cc4020--