Hi,
Actually, I meant Qt drivers, such as QOCI, QPSQL, QSQLITE etc. You don't need to recompile the entire Qt library, only the QODBC driver. Em 26/08/2014 10:14, zdenko podobny escreveu: > Hello, > > I try to retrieve strings from db with QODBC (QT 5.3.1 windows). > Database locale is en_US.819 (and ODBC driver does not work if client locale > is not set to en_US.819). Strings (stored by windows application in db) are > cp1250 encoded. > > And instead of "doručené" I got "doru?en?". > > Here is part of my code: > > QTextCodec::setCodecForLocale(QTextCodec::codecForName("cp1250")); > > QTextCodec *codec_db = QTextCodec::codecForName("latin1"); > > QSqlRecord rec = query.record(); > > qDebug() << "test: " << "doručené"; > > while (query.next()) { > > for (int x = 0; x < rec.count(); x++) { > > QVariant variant = query.value(x); > > if (rec.value(x).type() == QMetaType::QString) { > > QByteArray encodedString = codec_db->fromUnicode(variant.toByteArray()); > > qDebug() << "db_str: " << encodedString; > > } > > } > > } > > How can I fix encoding of db output? > > PS: In python 3.4.1 I am able to get correct output (via pyodbc) with this: > > print("db_str:", db_str.encode('latin1').decode('cp1250')) > > But I would prefer to use C++ and QT5... > > Zdenko > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest [1] -- /** * @AUTHOR Edgar Moraes Diniz * * edgar.di...@openmailbox.org */ Links: ------ [1] http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest