Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSqlQuery and Umlauts
Forum Updated to NodeBB v4.3 + New Features

QSqlQuery and Umlauts

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 4.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    EukeSnud
    wrote on last edited by
    #1

    German Umlauts are not being displayed properly when querying my oracle database. Database's characterset is set to 'WE8MSWIN1252'...
    I did not manage to find acceptable solutions on the forums...

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dialingo
      wrote on last edited by
      #2

      Are you using QSqlQuery? Then youre code will have a line like this:
      @QString country = query.value(fieldNo).toString();@

      You must not accept the standard conversion here. Therefore try to change it to
      @QByteArray byteArray = query.value(fieldNo).toByteArray();
      QTextCodec *codec = QTextCodec::codecForName("Windows-1252");
      QString string = codec->toUnicode(byteArray);
      @

      I did not test the code.

      1 Reply Last reply
      0
      • E Offline
        E Offline
        EukeSnud
        wrote on last edited by
        #3

        Yes, I am using QSqlQuery. Your solution did not work...

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dialingo
          wrote on last edited by
          #4

          I was guessing that WE8MSWIN1252 is Windows-1252. You can choose other codecs from this list:
          http://doc.qt.nokia.com/4.7/qtextcodec.html

          If none of the codecs matches your character set you can produce your own.
          Did you already verify that the content in the database really has the format you expect? Try to dump the QByteArray in hex format to verify the encoding.

          1 Reply Last reply
          0
          • E Offline
            E Offline
            EukeSnud
            wrote on last edited by
            #5

            Just found out that I got no problem when using the QOCI driver instead of QODBC, but I don't want to use this one since it is way slower than QODBC.

            In the API I found:
            For the Oracle 9 ODBC driver (Windows), it is neccessary to check "SQL_WCHAR support" in the ODBC driver manager otherwise Oracle will convert all Unicode strings to local 8-bit.

            I turned on "Force SQL_WCHAR support" on all of my data sources and now it is working! Thread can be closed...

            edit: Oups, I was mistaken, just forget to set QOCI back to QODBC :(

            1 Reply Last reply
            0
            • E Offline
              E Offline
              EukeSnud
              wrote on last edited by
              #6

              Still need help with this :(

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dialingo
                wrote on last edited by
                #7

                I lost overview what the status of the issue is. One driver delivers correct results the other doesn't, is it like this? Then it is a obviously a driver issue. Maybe you want to start a new thread where you present the results of your research so far.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved