From: Mark Wooding Date: Mon, 23 Jul 2018 01:26:53 +0000 (+0100) Subject: cgi/cgimain.c: Make the CGI program be (a little) locale-aware. X-Git-Tag: 5.2~11 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/c8d29a75d7ad8ef5cd0b2d0109f1db4f8a3c1368?ds=inline;hp=2af0fbca5e21d6ffa9663ff96b8a8f5d13c262d2 cgi/cgimain.c: Make the CGI program be (a little) locale-aware. Otherwise it can't properly parse configuration files which contain non-ASCII characters, e.g., for transforming pieces of track names. --- diff --git a/cgi/cgimain.c b/cgi/cgimain.c index 4ea98ec..236cca6 100644 --- a/cgi/cgimain.c +++ b/cgi/cgimain.c @@ -28,6 +28,7 @@ int main(int argc, char **argv) { progname = argv[0]; /* RFC 3875 s8.2 recommends rejecting PATH_INFO if we don't make use of * it. */ + if(!setlocale(LC_CTYPE, "")) disorder_error(errno, "error calling setlocale"); /* TODO we could make disorder/ACTION equivalent to disorder?action=ACTION */ if(getenv("PATH_INFO")) { /* TODO it might be nice to link back to the right place... */ diff --git a/cgi/disorder-cgi.h b/cgi/disorder-cgi.h index 168ba9b..7815632 100644 --- a/cgi/disorder-cgi.h +++ b/cgi/disorder-cgi.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "log.h"