Revision: 8842
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8842&view=rev
Author:   mdboom
Date:     2010-12-17 17:57:59 +0000 (Fri, 17 Dec 2010)

Log Message:
-----------
Fix Unicode encoding error saving SVGs with Unicode characters on some platforms

Modified Paths:
--------------
    branches/v1_0_maint/lib/matplotlib/backends/backend_svg.py

Modified: branches/v1_0_maint/lib/matplotlib/backends/backend_svg.py
===================================================================
--- branches/v1_0_maint/lib/matplotlib/backends/backend_svg.py  2010-12-14 
17:37:42 UTC (rev 8841)
+++ branches/v1_0_maint/lib/matplotlib/backends/backend_svg.py  2010-12-17 
17:57:59 UTC (rev 8842)
@@ -860,7 +860,7 @@
         if is_string_like(filename):
             fh_to_close = svgwriter = codecs.open(filename, 'w', 'utf-8')
         elif is_writable_file_like(filename):
-            svgwriter = codecs.EncodedFile(filename, 'utf-8')
+            svgwriter = codecs.getwriter('utf-8')(filename)
             fh_to_close = None
         else:
             raise ValueError("filename must be a path or a file-like object")
@@ -869,10 +869,10 @@
     def print_svgz(self, filename, *args, **kwargs):
         if is_string_like(filename):
             gzipwriter = gzip.GzipFile(filename, 'w')
-            fh_to_close = svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8')
+            fh_to_close = svgwriter = codecs.getwriter('utf-8')(gzipwriter)
         elif is_writable_file_like(filename):
             fh_to_close = gzipwriter = gzip.GzipFile(fileobj=filename, 
mode='w')
-            svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8')
+            svgwriter = codecs.getwriter('utf-8')(gzipwriter)
         else:
             raise ValueError("filename must be a path or a file-like object")
         return self._print_svg(filename, svgwriter, fh_to_close)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to