*ГОВНО *rubydef to_xml(nodeonly = true, name = 'content', namespace = nil, namespace_map = Atom::Xml::NamespaceMap.new) # :nodoc:
require 'iconv'
# Convert from utf-8 to utf-8 as a way of making sure the content is UTF-8.
#
# This is a pretty crappy way to do it but if we don't check libxml just
# fails silently and outputs the content element without any content. At
# least checking here and raising an exception gives the caller a chance
# to try and recitfy the situation.
#
begin
node = XML::Node.new("#{namespace_map.prefix(Atom::NAMESPACE, name)}")
node << Iconv.iconv('utf-8', 'utf-8', self.to_s)
node['type'] = 'html'
node['xml:lang'] = self.xml_lang if self.xml_lang
node
rescue Iconv::IllegalSequence => e
raise SerializationError, "Content must be converted to UTF-8 before attempting to serialize to XML: #{e.message}."
end
end