ODBC Driver issue
-
EukeSnud, I'm just curious: What Qt-Version, DB and OS are you using?
-
I'm using MaxDB (Version 7.6). The Table "DBPARAMETERS" says "_UNICODE" = "NO" and "DEFAULT_CODE" = "ASCII", which means that the varchar datatype is stored as ascii. However, the same software with an older Qt-Version (4.1) displays the Umlauts correctly.
Here's some background information: I've been trying to integrate an older software into a new environment. The old software was compiled in VS2003 with Qt 4.1. Now I've compiled it in VS2010 with Qt 4.7.3. Both versions run properly on Windows 7 with the same ODBC-driver. However, the old one displays the Umlauts correctly, while the new one does not. Therefore, I think it is the newer Qt-Version that is giving me a hard time. -
This webside says that MaxDB up to and including version 7.6 uses the ASCII-characterset ISO 8859/1.2 (if you chose to use Ascii): http://maxdb.sap.com/doc/7_7/44/bb285be00215b2e10000000a155369/content.htm
-
Neither
@
QTextCodec::setCodecForLocale(QTextCodec::codecForName("Latin1"));
@
nor
@
QTextCodec::setCodecForLocale(QTextCodec::codecForName("latin1"));
@
works. -
The following code changes the "�" to a "?". I do not know if that helps at all, to get to the source of the error.
Original code:
@
QString name =q2.value(1).toString(); //q2 being the QSqlQuery
@
Changed code (that changes the "�" to a "?"):
@
QByteArray encodedString = q2.value(1).toByteArray();
QTextCodec *codec = QTextCodec::codecForName("ISO 8859-1");
QString name = codec->toUnicode(encodedString);
@ -
Anyone any idea???