From 67e2b69ec96a117b98c9028013ce0258574efe80 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 9 Mar 2017 00:18:10 +0000 Subject: filter: set environment variable PYTHONIOENCODING to utf-8 This allows different versions of Python to be used rather than forcing version specific encoding in each script. Signed-off-by: Roy Marples Signed-off-by: John Keeping --- filter.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'filter.c') diff --git a/filter.c b/filter.c index 949c931..84dd0ed 100644 --- a/filter.c +++ b/filter.c @@ -55,6 +55,8 @@ static int open_exec_filter(struct cgit_filter *base, va_list ap) close(filter->pipe_fh[1]); chk_non_negative(dup2(filter->pipe_fh[0], STDIN_FILENO), "Unable to use pipe as STDIN"); + /* Always input/output utf-8 for a Python filter. */ + setenv("PYTHONIOENCODING", "utf-8", 1); execvp(filter->cmd, filter->argv); die_errno("Unable to exec subprocess %s", filter->cmd); } -- cgit v1.2.3-57-g22cb