#include <QApplication>
#include <QLabel>
#include <QDebug>
#include <QTextCodec>

/*
0x42 - B
0x6a - j
0xe2
0x80
0x9d - '"'
0xe2
0x84
0xa2 - 'tm'
0x72 - r
0x6e - n
*/

int main(int argc, char **argv)
{
  QApplication app(argc, argv);
  
  const char *utf8 = "\x42\x6a\xe2\x80\x9d\xe2\x84\xa2\x72\x6e";
  QString str = QString::fromUtf8(utf8);
  QLabel *lbl1 = new QLabel("Label 1: " + str);
  lbl1->show();

  QTextCodec *cp850 = QTextCodec::codecForName("cp850");
  QTextCodec *loc = QTextCodec::codecForLocale();
  QByteArray local8Bit = str.toLocal8Bit();
  
  QLabel *lbl2 = new QLabel("Label 2: " +
                            cp850->toUnicode(local8Bit));
  lbl2->show();
  
  QLabel *lbl3 = new QLabel("Label 3: " +
                            loc->toUnicode(utf8));
  lbl3->show();

  qDebug() << str;
  
  return app.exec();
}
