diff --git a/src/qamqpframe.cpp b/src/qamqpframe.cpp index 13cdf5c..8c57338 100644 --- a/src/qamqpframe.cpp +++ b/src/qamqpframe.cpp @@ -250,20 +250,20 @@ void QAmqpFrame::writeAmqpField(QDataStream &s, QAmqpMetaType::ValueType type, c break; case QAmqpMetaType::ShortString: { - QString str = value.toString(); + QByteArray str = value.toString().toUtf8(); if (str.length() >= 256) { qAmqpDebug() << Q_FUNC_INFO << "invalid shortstr length: " << str.length(); } s << quint8(str.length()); - s.writeRawData(str.toUtf8().data(), str.length()); + s.writeRawData(str.data(), str.length()); } break; case QAmqpMetaType::LongString: { - QString str = value.toString(); + QByteArray str = value.toString().toLatin1(); s << quint32(str.length()); - s.writeRawData(str.toLatin1().data(), str.length()); + s.writeRawData(str.data(), str.length()); } break; case QAmqpMetaType::Timestamp: diff --git a/tests/auto/qamqpqueue/tst_qamqpqueue.cpp b/tests/auto/qamqpqueue/tst_qamqpqueue.cpp index e61c3a4..6f4be15 100644 --- a/tests/auto/qamqpqueue/tst_qamqpqueue.cpp +++ b/tests/auto/qamqpqueue/tst_qamqpqueue.cpp @@ -48,6 +48,7 @@ private Q_SLOTS: void tableFieldDataTypes(); void messageProperties(); void emptyMessage(); + void sendUnicodeString(); void cleanupOnDeletion(); private: @@ -686,6 +687,17 @@ void tst_QAMQPQueue::emptyMessage() QVERIFY(message.payload().isEmpty()); } +void tst_QAMQPQueue::sendUnicodeString() +{ + QAmqpQueue *queue = client->createQueue("テストファイル"); + queue->declare(); + QVERIFY(waitForSignal(queue, SIGNAL(declared()))); + + // clean up queue + queue->remove(QAmqpQueue::roForce); + QVERIFY(waitForSignal(queue, SIGNAL(removed()))); +} + void tst_QAMQPQueue::cleanupOnDeletion() { // create, declare, and close the wrong way