PDA

View Full Version : QString to unicode characters



jsmax
19th September 2011, 00:21
Hi.

I have for example the string:


QString str = QString("string_тест") // There are russian characters in it

I need to make it look like this: "string_\u0442\u0435\u0441\u0442"

May be there is a function in Qt to make this ?

nish
19th September 2011, 10:41
you can take a single QChar and convert it.

QString s = ...;
s = "\\u"+QString::number(s[3].unicode) +........ ;