File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 7
7
8
8
import datetime
9
9
import json
10
+ import sys
10
11
import yaml
11
12
12
13
from . import xmlparser
17
18
from .rdf_converter import RDFReader , RDFWriter
18
19
from ..validation import Validation
19
20
21
+ try :
22
+ unicode = unicode
23
+ except NameError :
24
+ unicode = str
25
+
20
26
21
27
class ODMLWriter :
22
28
"""
@@ -58,7 +64,7 @@ def to_string(self, odml_document):
58
64
string_doc = ''
59
65
60
66
if self .parser == 'XML' :
61
- string_doc = str (xmlparser .XMLWriter (odml_document ))
67
+ string_doc = unicode (xmlparser .XMLWriter (odml_document ))
62
68
elif self .parser == "RDF" :
63
69
# Use turtle as default output format for now.
64
70
string_doc = RDFWriter (odml_document ).get_rdf_str ("turtle" )
@@ -74,6 +80,9 @@ def to_string(self, odml_document):
74
80
string_doc = json .dumps (odml_output , indent = 4 ,
75
81
cls = JSONDateTimeSerializer )
76
82
83
+ if sys .version_info .major < 3 :
84
+ string_doc = string_doc .encode ("utf-8" )
85
+
77
86
return string_doc
78
87
79
88
You can’t perform that action at this time.
0 commit comments