diff options
-rw-r--r-- | src/webbox.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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<html><body><h1>%1 %2</h1><p>%3</p></body></html>\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); |