From: Lars Haugseth Date: 2009-08-11T22:25:09+09:00 Subject: Re: Libxml: trying to set encoding for a document * matt_neuburg@tidbits.com (Matt Neuburg) wrote: > > Diana Jaunzeikare wrote: > >> >> I have problems with setting encoding for an xml file. I want to produce an >> xml file which starts with >> >> > > require 'rubygems' > require 'libxml' > doc = LibXML::XML::Document.new > puts doc.to_s #=> You may also specify indentation and the explicit encoding with parameters to the to_s method, like this: doc.to_s(:indent => true, :encoding => XML::Encoding::UTF_8) The documentation for XML::Document#to_s is quite buggy and I've filed a ticket. -- Lars Haugseth