Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/qamqpframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions tests/auto/qamqpqueue/tst_qamqpqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private Q_SLOTS:
void tableFieldDataTypes();
void messageProperties();
void emptyMessage();
void sendUnicodeString();
void cleanupOnDeletion();

private:
Expand Down Expand Up @@ -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
Expand Down