Got off the encoding
-
[quote]
@ QString str;
QByteArray bArray = process->readAllStandardOutput();
str = QString(bArray).toLocal8Bit();
QTextCodec * tc = QTextCodec::codecForLocale();
if(tc->canEncode(str))
textEdit->append(tc->toUnicode(bArray));@
[/quote]
You are worried about the outgoing encoding, but you forget the incoming encoding. This code makes no sense at all.Get your incoming encoding right:
@ // untested
QTextCodec *codec = QTextCodec::codecForLocale();
QByteArray bytes = process->readAllStandardOutput();
QString str = codec->toUnicode(bytes);
textEdit->append(str);
@While you're at it, check if codecForLocale() is actually the codec you need.
-
-
Process - rasdial.exe in Windows(http://msdn.microsoft.com/en-us/library/aa377004(v=vs.85).aspx )
Output on the russian language(on the my computer), but i dont know encoding of this process -
Consider choosing that locale explicitly:
@QTextCodec *cp1251 = QTextCodec::codecForName("Windows-1251");
QTextCodec *koi8u = QTextCodec::codecForName("KOI8-U");
@
for example, and see if that makes a difference in converting the string to unicode/QString.