diff --git a/addon-sdk/source/python-lib/cuddlefish/rdf.py b/addon-sdk/source/python-lib/cuddlefish/rdf.py index 0114fd96c0d..d15dc5c71db 100644 --- a/addon-sdk/source/python-lib/cuddlefish/rdf.py +++ b/addon-sdk/source/python-lib/cuddlefish/rdf.py @@ -11,24 +11,9 @@ EM_NS = "http://www.mozilla.org/2004/em-rdf#" class RDF(object): def __str__(self): - # real files have an .encoding attribute and use it when you - # write() unicode into them: they read()/write() unicode and - # put encoded bytes in the backend file. StringIO objects - # read()/write() unicode and put unicode in the backing store, - # so we must encode the output of getvalue() to get a - # bytestring. (cStringIO objects are weirder: they effectively - # have .encoding hardwired to "ascii" and put only bytes in - # the backing store, so we can't use them here). - # - # The encoding= argument to dom.writexml() merely sets the XML header's - # encoding= attribute. It still writes unencoded unicode to the output file, - # so we have to encode it for real afterwards. - # - # Also see: https://bugzilla.mozilla.org/show_bug.cgi?id=567660 - buf = io.StringIO() self.dom.writexml(buf, encoding="utf-8") - return buf.getvalue().encode('utf-8') + return buf.getvalue() class RDFUpdate(RDF): def __init__(self):