support utf8 in message
diff --git a/chatdialog.cpp b/chatdialog.cpp
index f9de0c3..5dad227 100644
--- a/chatdialog.cpp
+++ b/chatdialog.cpp
@@ -239,10 +239,10 @@
QTextCursor nextCursor(textEdit->textCursor());
nextCursor.movePosition(QTextCursor::End);
table = nextCursor.insertTable(1, 1, tableFormat);
- table->cellAt(0, 0).firstCursorPosition().insertText(msg.data().c_str());
+ table->cellAt(0, 0).firstCursorPosition().insertText(QString::fromUtf8(msg.data().c_str()));
if (!isHistory)
{
- showMessage(from, msg.data().c_str());
+ showMessage(from, QString::fromUtf8(msg.data().c_str()));
}
}
@@ -516,7 +516,7 @@
ChatDialog::formChatMessage(const QString &text, SyncDemo::ChatMessage &msg) {
msg.set_from(m_user.getNick().toStdString());
msg.set_to(m_user.getChatroom().toStdString());
- msg.set_data(text.toStdString());
+ msg.set_data(text.toUtf8().constData());
time_t seconds = time(NULL);
msg.set_timestamp(seconds);
msg.set_type(SyncDemo::ChatMessage::CHAT);