from lxml.builder import E from lxml import etree print etree.tostring(E.p(u'\xc3\xbf'))