Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Making webserver module read request bodies and write response bodies…

… using UTF-8
  • Loading branch information...
commit 42bf8b36d83bffbb1d4b2f11b58cd96ded64d5ec 1 parent 395af9c
@jimevans jimevans authored detro committed
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/webserver.cpp
View
6 src/webserver.cpp
@@ -221,9 +221,9 @@ bool WebServer::handleRequest(mg_event event, mg_connection *conn, const mg_requ
// Check if the 'Content-Type' requires decoding
if (headersObject["Content-Type"] == "application/x-www-form-urlencoded") {
requestObject["post"] = UrlEncodedParser::parse(QByteArray(data, read));
- requestObject["postRaw"] = QString::fromLocal8Bit(data, read);
+ requestObject["postRaw"] = QString::fromUtf8(data, read);
} else {
- requestObject["post"] = QString::fromLocal8Bit(data, read);
+ requestObject["post"] = QString::fromUtf8(data, read);
}
delete[] data;
} else {
@@ -405,7 +405,7 @@ void WebServerResponse::write(const QString &body)
writeHead(m_statusCode, m_headers);
}
///TODO: encoding?!
- const QByteArray data = body.toLocal8Bit();
+ const QByteArray data = body.toUtf8();
mg_write(m_conn, data.constData(), data.size());
}
Please sign in to comment.
Something went wrong with that request. Please try again.