@@ -984,6 +984,7 @@ def _print_figure(
984984 if isinstance (outfile ,
985985 (six .string_types , getattr (os , "PathLike" , ()),)):
986986 outfile = title = getattr (os , "fspath" , lambda obj : obj )(outfile )
987+ title = title .encode ("latin-1" , "replace" ).decode ()
987988 passed_in_file_object = False
988989 elif is_writable_file_like (outfile ):
989990 title = None
@@ -1071,7 +1072,7 @@ def print_figure_impl(fh):
10711072 else :
10721073 print ("%!PS-Adobe-3.0" , file = fh )
10731074 if title :
1074- print ("%%Title: " + title , file = fh )
1075+ print ("%%Title: " + title , file = fh )
10751076 print ("%%Creator: " + creator_str , file = fh )
10761077 # get source date from SOURCE_DATE_EPOCH, if set
10771078 # See https://reproducible-builds.org/specs/source-date-epoch/
@@ -1081,7 +1082,7 @@ def print_figure_impl(fh):
10811082 int (source_date_epoch )).strftime ("%a %b %d %H:%M:%S %Y" )
10821083 else :
10831084 source_date = time .ctime ()
1084- print ("%%CreationDate: " + source_date , file = fh )
1085+ print ("%%CreationDate: " + source_date , file = fh )
10851086 print ("%%Orientation: " + orientation , file = fh )
10861087 if not isEPSF :
10871088 print ("%%DocumentPaperSizes: " + papertype , file = fh )
0 commit comments