From c8d29a75d7ad8ef5cd0b2d0109f1db4f8a3c1368 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Mon, 23 Jul 2018 02:26:53 +0100 Subject: [PATCH] cgi/cgimain.c: Make the CGI program be (a little) locale-aware. Organization: Straylight/Edgeware From: Mark Wooding Otherwise it can't properly parse configuration files which contain non-ASCII characters, e.g., for transforming pieces of track names. --- cgi/cgimain.c | 1 + cgi/disorder-cgi.h | 1 + 2 files changed, 2 insertions(+) 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" -- [mdw]