# -*- coding: iso-8859-15 -*- from xml.dom import getDOMImplementation doc = getDOMImplementation ().createDocument (None,"rootnode",None) root = doc.documentElement root.appendChild(doc.createTextNode(unicode ("bäh!", "iso8859-15"))) print root.toxml() print string = root.toxml("utf-8") print repr (string) print string print string = root.toxml("latin-1") print repr (string) print string