@@ -756,7 +756,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
756
756
except KeyError :
757
757
ps_name = sfnt [(3 ,1 ,0x0409 ,6 )].decode (
758
758
'utf-16be' )
759
- ps_name = ps_name .encode ('ascii' ,'replace' )
759
+ ps_name = ps_name .encode ('ascii' , 'replace' )
760
760
self .set_font (ps_name , prop .get_size_in_points ())
761
761
762
762
cmap = font .get_charmap ()
@@ -1184,7 +1184,7 @@ def print_figure_impl():
1184
1184
# We are going to use an external program to process the output.
1185
1185
# Write to a temporary file.
1186
1186
fd , tmpfile = mkstemp ()
1187
- with io .open (fd , 'w' , encoding = 'ascii ' ) as fh :
1187
+ with io .open (fd , 'w' , encoding = 'latin-1 ' ) as fh :
1188
1188
print_figure_impl ()
1189
1189
else :
1190
1190
# Write directly to outfile.
@@ -1193,7 +1193,7 @@ def print_figure_impl():
1193
1193
1194
1194
if (not requires_unicode and
1195
1195
(six .PY3 or not isinstance (outfile , StringIO ))):
1196
- fh = io .TextIOWrapper (outfile , encoding = "ascii " )
1196
+ fh = io .TextIOWrapper (outfile , encoding = "latin-1 " )
1197
1197
# Prevent the io.TextIOWrapper from closing the
1198
1198
# underlying file
1199
1199
def do_nothing ():
@@ -1204,7 +1204,7 @@ def do_nothing():
1204
1204
1205
1205
print_figure_impl ()
1206
1206
else :
1207
- with io .open (outfile , 'w' , encoding = 'ascii ' ) as fh :
1207
+ with io .open (outfile , 'w' , encoding = 'latin-1 ' ) as fh :
1208
1208
print_figure_impl ()
1209
1209
1210
1210
if rcParams ['ps.usedistiller' ]:
@@ -1216,7 +1216,7 @@ def do_nothing():
1216
1216
if passed_in_file_object :
1217
1217
if file_requires_unicode (outfile ):
1218
1218
with io .open (tmpfile , 'rb' ) as fh :
1219
- outfile .write (fh .read ().decode ('ascii ' ))
1219
+ outfile .write (fh .read ().decode ('latin-1 ' ))
1220
1220
else :
1221
1221
with io .open (tmpfile , 'rb' ) as fh :
1222
1222
outfile .write (fh .read ())
@@ -1290,7 +1290,7 @@ def write(self, *kl, **kwargs):
1290
1290
1291
1291
# write to a temp file, we'll move it to outfile when done
1292
1292
fd , tmpfile = mkstemp ()
1293
- with io .open (fd , 'w' , encoding = 'ascii ' ) as fh :
1293
+ with io .open (fd , 'w' , encoding = 'latin-1 ' ) as fh :
1294
1294
# write the Encapsulated PostScript headers
1295
1295
print ("%!PS-Adobe-3.0 EPSF-3.0" , file = fh )
1296
1296
if title : print ("%%Title: " + title , file = fh )
@@ -1373,7 +1373,7 @@ def write(self, *kl, **kwargs):
1373
1373
if is_writable_file_like (outfile ):
1374
1374
if file_requires_unicode (outfile ):
1375
1375
with io .open (tmpfile , 'rb' ) as fh :
1376
- outfile .write (fh .read ().decode ('ascii ' ))
1376
+ outfile .write (fh .read ().decode ('latin-1 ' ))
1377
1377
else :
1378
1378
with io .open (tmpfile , 'rb' ) as fh :
1379
1379
outfile .write (fh .read ())
0 commit comments