summaryrefslogtreecommitdiff
path: root/gpdl
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2022-10-04 11:22:05 +0100
committerRobin Watts <Robin.Watts@artifex.com>2022-10-04 11:25:33 +0100
commit8f1056391d3d58c4a5d20a90eaa1f5d4c604b357 (patch)
treea2efb7ebb43191d226e6acabd4094cc6e5d2a0e9 /gpdl
parent610cf851fbbe1fc342f40429b1b0da9d9d7daebc (diff)
downloadghostpdl-8f1056391d3d58c4a5d20a90eaa1f5d4c604b357.tar.gz
Bug 705931: Avoid double encoding filenames with gs under gpdl.
When the postscript interpreter is run by itself, it has to cope with decoding arguments supplied on the command line into our internal format of utf8. For windows, this means that it has to cope with converting from 'local' encoding to utf8. When we run gs under gpdl this decoding is done under the pl level, so it's important that gs does not do such decoding otherwise it will 'double decode'. Accordingly, disable the decoding in the psitop.c layer.
Diffstat (limited to 'gpdl')
-rw-r--r--gpdl/psitop.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gpdl/psitop.c b/gpdl/psitop.c
index 7f6a0e3c6..94dfa2a8b 100644
--- a/gpdl/psitop.c
+++ b/gpdl/psitop.c
@@ -344,6 +344,13 @@ ps_impl_allocate_interp_instance(pl_interp_implementation_t *impl, gs_memory_t *
return code;
}
+ /* The above call to psapi_new_instance will have set the ps interpreter
+ * to expect 'local' encoding. When running under PL, this means we'll
+ * end up decoding the input stuff to utf8, and then feed that into the
+ * gs instance, where it will decode it again! Avoid this, by setting
+ * gs to expect UTF8 input. */
+ psapi_set_arg_encoding(psi->psapi_instance, PS_ARG_ENCODING_UTF8);
+
impl->interp_client_data = psi;
/* Tell gs not to ignore a UEL, but do an interpreter exit */