aboutsummaryrefslogtreecommitdiffstats
path: root/filter.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2017-03-09 01:18:10 +0100
committerLukas Fleischer <lfleischer@lfos.de>2017-08-10 15:15:55 +0200
commit67e2b69ec96a117b98c9028013ce0258574efe80 (patch)
treeb15b6f1753bdd3b941ace3ce4cd1e0cf81885807 /filter.c
parent7f7f91141ced1085dd2c6dbc5c65703d73b1b8c7 (diff)
downloadcgit-67e2b69ec96a117b98c9028013ce0258574efe80.tar.gz
cgit-67e2b69ec96a117b98c9028013ce0258574efe80.tar.xz
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 <roy@marples.name> Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'filter.c')
-rw-r--r--filter.c2
1 files changed, 2 insertions, 0 deletions
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);
}