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. Issue with localeawarecompare in QT 4.8
Forum Updated to NodeBB v4.3 + New Features

Issue with localeawarecompare in QT 4.8

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.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.
  • S Offline
    S Offline
    sreek82
    wrote on last edited by
    #1

    Hello,

    I am working on comparing two strings(in different languages). So, to get sorted the strings correctly, I am using localeawarecompare to compare strings. But the result is not as expected. I set the locale enviroment variables to correct language(*.utf8). But still the words are not arranged in correct order.

    Do I need to set anyother variables. Please help me

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Locale aware compare has been properly fixed in Qt 5.2. In Qt 4.8 it might not work as expected. Is an upgrade possible in your situation?

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sreek82
        wrote on last edited by
        #3

        No. I cant upgrade to next version. Is there another way I can implement the same functionality

        Thanks

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Try setting the text codec as the documentation suggests: "link":http://qt-project.org/doc/qt-4.8/qstring.html#localeAwareCompare, and more importantly, "link":http://qt-project.org/doc/qt-4.8/qtextcodec.html#setCodecForLocale.

          (Z(:^

          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