##// END OF EJS Templates
check for unicode before encoding as UTF-8
Martin Spacek -
Show More
@@ -21,6 +21,9 b' def save_svg(string, parent=None):'
21 The name of the file to which the document was saved, or None if the save
21 The name of the file to which the document was saved, or None if the save
22 was cancelled.
22 was cancelled.
23 """
23 """
24 if isinstance(string, unicode):
25 string = string.encode('utf-8')
26
24 dialog = QtGui.QFileDialog(parent, 'Save SVG Document')
27 dialog = QtGui.QFileDialog(parent, 'Save SVG Document')
25 dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
28 dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
26 dialog.setDefaultSuffix('svg')
29 dialog.setDefaultSuffix('svg')
@@ -29,7 +32,7 b' def save_svg(string, parent=None):'
29 filename = dialog.selectedFiles()[0]
32 filename = dialog.selectedFiles()[0]
30 f = open(filename, 'w')
33 f = open(filename, 'w')
31 try:
34 try:
32 f.write(string.encode('UTF-8'))
35 f.write(string)
33 finally:
36 finally:
34 f.close()
37 f.close()
35 return filename
38 return filename
General Comments 0
You need to be logged in to leave comments. Login now