@@ -756,7 +756,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
756756 except KeyError :
757757 ps_name = sfnt [(3 ,1 ,0x0409 ,6 )].decode (
758758 'utf-16be' )
759- ps_name = ps_name .encode ('ascii' ,'replace' )
759+ ps_name = ps_name .encode ('ascii' , 'replace' )
760760 self .set_font (ps_name , prop .get_size_in_points ())
761761
762762 cmap = font .get_charmap ()
@@ -1184,7 +1184,7 @@ def print_figure_impl():
11841184 # We are going to use an external program to process the output.
11851185 # Write to a temporary file.
11861186 fd , tmpfile = mkstemp ()
1187- with io .open (fd , 'w' , encoding = 'ascii ' ) as fh :
1187+ with io .open (fd , 'w' , encoding = 'latin-1 ' ) as fh :
11881188 print_figure_impl ()
11891189 else :
11901190 # Write directly to outfile.
@@ -1193,7 +1193,7 @@ def print_figure_impl():
11931193
11941194 if (not requires_unicode and
11951195 (six .PY3 or not isinstance (outfile , StringIO ))):
1196- fh = io .TextIOWrapper (outfile , encoding = "ascii " )
1196+ fh = io .TextIOWrapper (outfile , encoding = "latin-1 " )
11971197 # Prevent the io.TextIOWrapper from closing the
11981198 # underlying file
11991199 def do_nothing ():
@@ -1204,7 +1204,7 @@ def do_nothing():
12041204
12051205 print_figure_impl ()
12061206 else :
1207- with io .open (outfile , 'w' , encoding = 'ascii ' ) as fh :
1207+ with io .open (outfile , 'w' , encoding = 'latin-1 ' ) as fh :
12081208 print_figure_impl ()
12091209
12101210 if rcParams ['ps.usedistiller' ]:
@@ -1216,7 +1216,7 @@ def do_nothing():
12161216 if passed_in_file_object :
12171217 if file_requires_unicode (outfile ):
12181218 with io .open (tmpfile , 'rb' ) as fh :
1219- outfile .write (fh .read ().decode ('ascii ' ))
1219+ outfile .write (fh .read ().decode ('latin-1 ' ))
12201220 else :
12211221 with io .open (tmpfile , 'rb' ) as fh :
12221222 outfile .write (fh .read ())
@@ -1290,7 +1290,7 @@ def write(self, *kl, **kwargs):
12901290
12911291 # write to a temp file, we'll move it to outfile when done
12921292 fd , tmpfile = mkstemp ()
1293- with io .open (fd , 'w' , encoding = 'ascii ' ) as fh :
1293+ with io .open (fd , 'w' , encoding = 'latin-1 ' ) as fh :
12941294 # write the Encapsulated PostScript headers
12951295 print ("%!PS-Adobe-3.0 EPSF-3.0" , file = fh )
12961296 if title : print ("%%Title: " + title , file = fh )
@@ -1373,7 +1373,7 @@ def write(self, *kl, **kwargs):
13731373 if is_writable_file_like (outfile ):
13741374 if file_requires_unicode (outfile ):
13751375 with io .open (tmpfile , 'rb' ) as fh :
1376- outfile .write (fh .read ().decode ('ascii ' ))
1376+ outfile .write (fh .read ().decode ('latin-1 ' ))
13771377 else :
13781378 with io .open (tmpfile , 'rb' ) as fh :
13791379 outfile .write (fh .read ())
0 commit comments