From 3f3624559bbc4da4347b2574cdf851ee660e863c Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sun, 23 Feb 2020 10:54:35 +0100 Subject: [PATCH] Ensure UTF-8 strings --- src/ippmsg.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ippmsg.cpp b/src/ippmsg.cpp index c0cf29c..a0afc91 100644 --- a/src/ippmsg.cpp +++ b/src/ippmsg.cpp @@ -268,8 +268,12 @@ Bytestream IppMsg::encode_attr(quint8 tag, QString name, QJsonValueRef value) case Charset: case NaturalLanguage: case MimeMediaType: - req << quint16(value.toString().length()) << value.toString().toStdString(); + { + QByteArray tmpstr = value.toString().toUtf8(); + req << quint16(tmpstr.length()); + req.putBytes(tmpstr.data(), tmpstr.length()); break; + } default: qDebug() << "uncaught tag" << tag; Q_ASSERT(false);