--Boundary-00=_a+qiK9INhdZrZGi Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit ... forgot to attach the sample regarding __ insertion... (and sanitized testing) --Boundary-00=_a+qiK9INhdZrZGi Content-Type: text/x-c++src; charset="UTF-8"; name="objectnametest.cc" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="objectnametest.cc" //#define QT_NO_CAST_FROM_ASCII //#define QT_NO_CAST_TO_ASCII #include #include #include bool isIdentifier(const QChar &c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || (c >= '1' && c <= '9'); } main (int argc, char **argv) { if (argc < 2) qDebug() << "you forgot the object name"; else { QObject o; o.setObjectName(QString::fromUtf8(argv[1])); qDebug() << o.objectName() << o.objectName().length(); QString string = o.objectName(); for (int i = 0; i < string.length(); ++i) if (!isIdentifier(string[i])) { QString unicode = QString::number(string[i].unicode()) + '_'; string[i] = '_'; string.insert(i+1, unicode); i += unicode.length(); } qDebug() << string << string.length(); } } --Boundary-00=_a+qiK9INhdZrZGi--