[ocrfeeder] Fix unicode issues when saving a project
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder] Fix unicode issues when saving a project
- Date: Sat, 20 Dec 2014 22:40:00 +0000 (UTC)
commit 70c257eb10301ebcf04f16f1a296dd56eb07fbe1
Author: Joaquim Rocha <me joaquimrocha com>
Date: Thu Dec 18 20:27:57 2014 +0000
Fix unicode issues when saving a project
src/ocrfeeder/studio/project.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/ocrfeeder/studio/project.py b/src/ocrfeeder/studio/project.py
index 4586275..188b0f5 100644
--- a/src/ocrfeeder/studio/project.py
+++ b/src/ocrfeeder/studio/project.py
@@ -75,7 +75,8 @@ class ProjectSaver:
for element in item:
self.convertToXml(element, root_node)
else:
- text_node = self.document.createTextNode(str(item))
+ text = unicode(str(item), 'utf-8')
+ text_node = self.document.createTextNode(text)
root_node.appendChild(text_node)
return root_node
@@ -84,7 +85,7 @@ class ProjectSaver:
pages_dict = {'pages': [page_data.convertToDict() for page_data in self.pages_data]}
new_node = self.convertToXml(pages_dict, root_node)
self.__imagesToXml(root_node)
- self.__createProjectFile(new_node.toxml(), file_name)
+ self.__createProjectFile(new_node.toxml('utf-8'), file_name)
def __createProjectFile(self, xml_content, file_name):
temp_dir = tempfile.mkstemp(dir = self.temp_dir)[1]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]