def to_utf8
      self.each_element { |el|
        el.texts.each_index  {|i|
          el.texts[i].value = el.texts[i].to_s.to_utf8
        }
        el.attributes.each { |name,val|
          el.attributes[name] = val.to_utf8
        }
        el.to_utf8 if el.has_elements?
      }
      return self
    end
def to_utf8
      self.each_element { |el|
        el.texts.each_index  {|i|
          el.texts[i].value = el.texts[i].to_s.to_utf8
        }
        el.attributes.each { |name,val|
          el.attributes[name] = val.to_utf8
        }
        el.to_utf8 if el.has_elements?
      }
      return self
    end
Convert XHTML+MathML Named Entities in a REXML::Element to UTF-8

  :call-seq:
     tree.to_utf8  -> REXML::Element

 Note that this method needs to traverse the entire tree, converting text nodes and attributes
 for each element. This can be SLOW. It will often be faster to serialize to a string and then
 use String.to_utf8 instead.