From ae248732206b6b04dd476cef03f08c427c333b14 Mon Sep 17 00:00:00 2001 From: Roland Stigge Date: Sun, 7 Jan 2018 17:25:24 +0100 Subject: Fix Umlaut handling --- src/webbox.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/webbox.cpp b/src/webbox.cpp index d1e2c50..71f023c 100644 --- a/src/webbox.cpp +++ b/src/webbox.cpp @@ -43,7 +43,15 @@ QString httpError(int httpStatusCode, QString message) { return QString("Status: %1 %2\r\nContent-Type: text/html\r\n\r\n

%1 %2

%3

\r\n").arg(httpStatusCode).arg(description).arg(message); } +void initlocale() { + if (setenv("LC_ALL", "UTF-8", 1)) { + exit(1); + } +} + int main(int argc, char* argv[]) { + initlocale(); + int result = FCGX_Init(); if (result != 0) { return 1; // error on init @@ -444,7 +452,7 @@ int main(int argc, char* argv[]) { if (end == -1) { FCGX_PutS(QString("Error reading filename / end").toUtf8().data(), request.out); } else { - QString filename = content.mid(start, end - start); + QString filename = QString::fromUtf8(content.mid(start, end - start)); if (filename.size() < 1) { FCGX_PutS(QString("Bad filename").toUtf8().data(), request.out); -- cgit v1.2.3