From 6a0fa994ca6623d31221b1705f5cabc3b64596a9 2011-06-01 22:11:31 From: Min RK Date: 2011-06-01 22:11:31 Subject: [PATCH] Merge pull request #490 from mspacek/svg-unicode fix UnicodeEncodeError writing SVG string to .svg file closes gh-489 --- diff --git a/IPython/frontend/qt/svg.py b/IPython/frontend/qt/svg.py index 8081dca..aa2bf4b 100644 --- a/IPython/frontend/qt/svg.py +++ b/IPython/frontend/qt/svg.py @@ -21,6 +21,9 @@ def save_svg(string, parent=None): The name of the file to which the document was saved, or None if the save was cancelled. """ + if isinstance(string, unicode): + string = string.encode('utf-8') + dialog = QtGui.QFileDialog(parent, 'Save SVG Document') dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave) dialog.setDefaultSuffix('svg')