Hi. I'm parsing an email message headers. The strings are encoded with Base64 algoritm and are in KOI8-R codepage.
I do the following:
Qt Code:
  1. QByteArray a = QByteArray::fromBase64(src);
  2. // here in 'a' I have decoded text in KOI8-R encoding
  3. QTextCodec *pCodec = QTextCodec::codecForName("koi8-r");
  4. QByteArray b = pCodec->toUnicode(a).toUtf8();
  5. // in 'b' I have garbage instead of desired text
To copy to clipboard, switch view to plain text mode 

What's wrong with the code?