##// END OF EJS Templates
unicode fixes in SVG...
MinRK -
Show More
@@ -22,7 +22,7 b' from __future__ import print_function'
22 import os
22 import os
23 import struct
23 import struct
24
24
25 from IPython.utils.py3compat import string_types
25 from IPython.utils.py3compat import string_types, cast_bytes_py2, cast_unicode
26
26
27 from .displaypub import publish_display_data
27 from .displaypub import publish_display_data
28
28
@@ -377,6 +377,7 b' class SVG(DisplayObject):'
377 return
377 return
378 # parse into dom object
378 # parse into dom object
379 from xml.dom import minidom
379 from xml.dom import minidom
380 svg = cast_bytes_py2(svg)
380 x = minidom.parseString(svg)
381 x = minidom.parseString(svg)
381 # get svg tag (should be 1)
382 # get svg tag (should be 1)
382 found_svg = x.getElementsByTagName('svg')
383 found_svg = x.getElementsByTagName('svg')
@@ -386,6 +387,7 b' class SVG(DisplayObject):'
386 # fallback on the input, trust the user
387 # fallback on the input, trust the user
387 # but this is probably an error.
388 # but this is probably an error.
388 pass
389 pass
390 svg = cast_unicode(svg)
389 self._data = svg
391 self._data = svg
390
392
391 def _repr_svg_(self):
393 def _repr_svg_(self):
General Comments 0
You need to be logged in to leave comments. Login now