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. Is Qt library support Unicode?

Is Qt library support Unicode?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.1k 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.
  • C Offline
    C Offline
    chcw
    wrote on last edited by
    #1

    Is Qt library support Unicode and MBCS? In a Qt Creator project, how can I set the project to produce Unicode or MBCS executables?

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      "QString":http://doc-snapshot.qt-project.org/4.8/qstring.html automatically stores Unicode strings. You don't need to do set anything special.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MuldeR
        wrote on last edited by
        #3

        Qt's own String class, QString, is Unicode all the way. Its internal representation/encoding is UTF-16, always. If you need the "raw" UTF-16 string data, use QString::utf16(). Note that you may need to cast the pointer returned by that function to wchar_t* before you can pass it into Win32 API functions (or any other function that uses the wchar_t* type), because it returns a ushort* pointer. If you need a "multi-byte" representation of the QString, you may use QString::toUtf8(), QString::toAscii() or QString::toLocal8Bit() as needed. All three functions return a QByteArray, from which you can get the "raw" string as char* via QByteArray::constData().

        My OpenSource software at: http://muldersoft.com/

        Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

        Go visit the coop: http://youtu.be/Jay...

        1 Reply Last reply
        0
        • C Offline
          C Offline
          chcw
          wrote on last edited by
          #4

          Thank you so much.

          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