Using the QtOpcUa library I read a "string" from a PLC. The retrieved data is a QVariant:
void MyClass::opcua_valueChanged(QString key, QVariant value)
{
qDebug() << value;
}
here a real output:
QVariant(QString, "\u0000\u0000\u0000\u0000\u000E@��\u0005���\u0010�M�X���")
Since it starts with a \0 char, I expect it is an empty string.
But if I do something like:
QString s = value.toString().trimmed();
qDebug() << s;
I get:
"\u0000\u0000\u0000\u0000\u000E@��\u0005���\u0010�M�X���"
instead of: "".
What I have to do in order to get the "real" empty string, since it starts with a null char?
Based upon the comments received I solved in this way: