diff -Nur gnome-doc-utils-0.20.10-orig/xml2po/xml2po/__init__.py gnome-doc-utils-0.20.10/xml2po/xml2po/__init__.py --- gnome-doc-utils-0.20.10-orig/xml2po/xml2po/__init__.py 2020-05-01 19:15:02.937514100 +0200 +++ gnome-doc-utils-0.20.10/xml2po/xml2po/__init__.py 2020-05-01 19:31:34.676207600 +0200 @@ -259,7 +259,7 @@ if not self.expand_entities: result += '&' + child.name + ';' else: - result += child.content.decode('utf-8') + result += child.content else: result += self.myAttributeSerialize(child) child = child.next @@ -338,7 +338,7 @@ pass if not newnode: - print("""Error while parsing translation as XML:\n"%s"\n""" % (text.encode('utf-8')), file=sys.stderr) + print("""Error while parsing translation as XML:\n"%s"\n""" % (text), file=sys.stderr) return newelem = newnode.getRootElement() @@ -423,7 +423,7 @@ outtxt = self.normalizeString(attr.content) if self.app.operation == 'merge': translation = self.app.getTranslation(outtxt) - self.replaceAttributeContentsWithText(attr, translation.encode('utf-8')) + self.replaceAttributeContentsWithText(attr, translation) else: self.app.msg.outputMessage(outtxt, node.lineNo(), "", spacepreserve=False, tag = node.name + ":" + attr.name) @@ -464,7 +464,7 @@ norm_outtxt = self.normalizeString(outtxt, self.app.isSpacePreserveNode(node)) translation = self.app.getTranslation(norm_outtxt) else: - translation = outtxt.decode('utf-8') + translation = outtxt starttag = self.startTagForNode(node) endtag = self.endTagForNode(node) @@ -504,7 +504,7 @@ # !!! This is not very nice thing to do, but I don't know if # raising an exception is any better return False - return tmpstr.find('EXTERNAL_GENERAL_PARSED_ENTITY') != -1 + return tmpstr.find(b'EXTERNAL_GENERAL_PARSED_ENTITY') != -1 def doSerialize(self, node): """Serializes a node and its children, emitting PO messages along the way. @@ -552,11 +552,11 @@ self.current_mode = self.load_mode(mode)() # Prepare output if operation == 'update': - self.out = tempfile.TemporaryFile() + self.out = tempfile.TemporaryFile("w+", encoding="utf-8") elif output == '-': self.out = sys.stdout else: - self.out = file(output, 'w') + self.out = open(output, 'w', encoding="utf-8") def load_mode(self, modename): try: