From 92031c06ac969f8b298eb788365a929b755f8bd9 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 26 Nov 2018 22:22:05 +0100 Subject: [PATCH] Backport PR #12890: Restrict postscript title to ascii. --- lib/matplotlib/backends/backend_ps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index 1304fae9dd82..fb39ba6d7d13 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -973,7 +973,7 @@ def _print_figure( isEPSF = format == 'eps' if isinstance(outfile, (str, getattr(os, "PathLike", ()),)): outfile = title = getattr(os, "fspath", lambda obj: obj)(outfile) - title = title.encode("latin-1", "replace").decode("latin-1") + title = title.encode("ascii", "replace").decode("ascii") passed_in_file_object = False elif is_writable_file_like(outfile): title = None