From 96ba75eabda6bd8b46487d9a3cc86f8da8a7efca Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sun, 16 Sep 2018 03:40:02 -0700 Subject: [PATCH] Ghostscript: fix issues in strict ASCII implementation --- src/ocrmypdf/pdfa.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ocrmypdf/pdfa.py b/src/ocrmypdf/pdfa.py index 5cac0e6c..8e3df597 100644 --- a/src/ocrmypdf/pdfa.py +++ b/src/ocrmypdf/pdfa.py @@ -131,6 +131,7 @@ def _encode_ascii(s: str) -> str: '(': '', ')': '', '\\': '', + '\0': '' }) return s.translate(trans).encode('ascii', errors='replace').decode() @@ -284,7 +285,7 @@ def generate_pdfa_ps(target_filename, pdfmark, icc='sRGB', ascii_docinfo=False): hex_icc_profile = hexlify(bytes_icc_profile) icc_profile = '<' + hex_icc_profile.decode('ascii') + '>' - ps = _get_pdfa_def(icc_profile, icc, pdfmark) + ps = _get_pdfa_def(icc_profile, icc, pdfmark, ascii_docinfo=ascii_docinfo) # We should have encoded everything to pure ASCII by this point, and # to be safe, only allow ASCII in PostScript