Announcement

Collapse
No announcement yet.

Windows XP partial number sorting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Windows XP partial number sorting

    I sometimes encounter a difference between how my Window Explorer sorts files and how IrfanView sorts files. I never fully investigated why this was, but it started to become annoying today, so I investigated it. Note that I did this with a Dutch version of Windows XP, but I think this bug is not directly related to the languague.

    Assume a folder with the following file names:

    0001.jpg
    001.jpg
    01c.jpeg
    0002.jpg
    002.jpg
    -002.jpg
    03.jpg

    The attachment shows how Window Explorer sorts these.
    However in IrfanView the sort order is different when using the Option > Sort Directory Files > by Name (ascending, XP Style). In IrfanView the order becomes:

    -002.jpg
    01c.jpeg
    03.jpg
    001.jpg
    002.jpg
    0001.jpg
    0002.jpg

    Click image for larger version

Name:	sort-xp.png
Views:	1
Size:	4.9 KB
ID:	84123

    PS, This is probably hard to fix as one has to reverse engineer the way the Windows Shell sorts. Microsoft probably made a Shell sort function, but I bet that it's only implemented on Windows XP and higher. Maybe someone knows the correct pseudo algorithm?

    #2
    Sort Mis-match

    This is very annoying. Look at what IrfanView does with these names when sorting by name XP style:

    [ATTACH]898[/ATTACH][ATTACH]899[/ATTACH]

    What can be done about this?

    Comment


      #3
      Why can't IrfanView follow the name sort order in Windows Explorer like other programs can? WildBit Viewer is one example. Is there functionality in IrfanView that wouldn't support it?

      Comment


        #4
        The problem here is, that in fact IrfanView is following the basic kernel rules, while Exploder doesn't.
        It makes modifications in the basic order, to make it more consumer-convenient.
        Ordening on name has a simple algoritm : check the first character and lookup the order in the ascii-table. And so on.
        0.6180339887
        Rest In Peace, Sam!

        Comment


          #5
          I know I can sort by name in IrfanView, but shouldn't sort by name XP style actually match XP? Why offer this sort method if it can't be in sync with an actual Explorer folder? If other viewers/software can use Explorer's sort order, why can't IrfanView simply use it too. Is there an actual reason why it has to use its own algorithm which crudely tries to mimic XP's sort order, instead of just reading the order used in the folder? How does the other software manage to do it?

          Comment


            #6
            The problem is more with the name "XP style". There is in fact no single XP style. The default sort order is set by a key in the registry, and changes for different language settings.
            I suspect that Irfan (with his known aversion to registry settings!) chooses to define his own fixed sort order rather than using that registry key as XP does.
            The most significant change from Win2K to XP is that numbers are handled in true mathematical order and I think Irfanview does replicate that in "XP style". How alphabetic and punctuation characters ought to be handled when mixed in with numbers is open to argument.

            Comment


              #7
              OK, so if Irfan won't use the registry key then it probably won't improve. I see the problem though about using it, because not all supported operating systems will even have it. I don't think the language settings would be that problematic, since that would match the user's environment.

              It just sure would be nice if you could view items in the same order as you see them in Windows. Considering how IrfanView has to interact with Windows in other ways, I am surprised that there is no alternative to the registry. I mean, I can workaround the problem by importing the files into the Slideshow dialog and loading my saved list into Thumbnails with the preserved order. Why couldn't IrfanView do that for me in the programming?

              Originally posted by Mij View Post
              The most significant change from Win2K to XP is that numbers are handled in true mathematical order and I think Irfanview does replicate that in "XP style".
              Are you sure?

              [ATTACH]902[/ATTACH]

              Comment


                #8
                Originally posted by Skippybox View Post
                Are you sure?
                No. It does get that one wrong
                - as does XnView (sort by Name-numeric). Zoom browser gets it wrong a different way...
                .. but Faststone and Wildbit get it right, as you say.
                Then I gave up...
                Last edited by Mij; 10.10.2008, 05:48 PM.

                Comment


                  #9
                  Yes, but only WildBit does the first set of files right, too! FastStone gets those wrong. Every viewer seems to do sorting a little different.

                  Comment


                    #10
                    Here is the comparison of WildBit Viewer and Windows Explorer:

                    [ATTACH]918[/ATTACH][ATTACH]919[/ATTACH]

                    Comment


                      #11
                      Your latest screenshot is a good example.
                      The thumbnails part shows a standard order based on checking the number of digits first, then the value.
                      That's why, if one has file1-file12, one has to add a leading zero to file1-file9, to get the right numerical order.
                      Maybe I'm an old geezer, but the order in the 'test' dialog looks quite ridiculous to me.
                      Every viewer seems to do sorting a little different.
                      These interpretation problems obviously occured after introducing the XP-concept.
                      So I question the definition of what is the right one, and which one the wrong.
                      The most significant change from Win2K to XP is that numbers are handled in true mathematical order
                      I recently made such a OS change, and I didn't notice any difference. But maybe this is due to using TC instead of explorer.
                      0.6180339887
                      Rest In Peace, Sam!

                      Comment


                        #12
                        Originally posted by Sam_Zen View Post
                        Your latest screenshot is a good example.
                        The thumbnails part shows a standard order based on checking the number of digits first, then the value.
                        That's why, if one has file1-file12, one has to add a leading zero to file1-file9, to get the right numerical order.
                        Yes, you could do that, but then you would be compensating for the sort function which would defeat the purpose. Essentially, there would be no difference between sort by name and sort by name XP style.
                        Maybe I'm an old geezer, but the order in the 'test' dialog looks quite ridiculous to me.
                        Sure, I wouldn't use it, but some people do. However, it is a good illustration of how messed up the order can get in IrfanView. You also can't pad these to sort correctly.

                        These interpretation problems obviously occured after introducing the XP-concept.
                        So I question the definition of what is the right one, and which one the wrong.
                        I don't think there is a right or wrong way of sorting either. But, since a standard has been instituted in XP, I think sort by XP should at least conform to that. In that sense, it is the only "right" one to use, considering you can still choose sort by name in IrfanView if you want.

                        I recently made such a OS change, and I didn't notice any difference. But maybe this is due to using TC instead of explorer.
                        It is possible that you could completely isolate yourself from this problem, especially if you use a file manager like TC and use sort by name exclusively. However, this ignores the sort by name XP style. So, why would it uselessly be present in the program? I think many people use Windows and I'm sure the revised sort order in XP was made for a reason. Therefore, I don't know why it couldn't be more supported.

                        Sam_Zen, don't forget to look at my new screenshots in case you missed them.

                        Comment


                          #13
                          Didn't miss them.
                          You're probably right about the isolation. I may be an exception, but I don't use TC solely as a file manager, but it's my 'desktop-manager'.
                          The first thing to start, the last thing to close.
                          0.6180339887
                          Rest In Peace, Sam!

                          Comment


                            #14
                            The most significant change from Win2K to XP is that numbers are handled in true mathematical order
                            Originally posted by Sam_Zen View Post
                            I recently made such a OS change, and I didn't notice any difference. But maybe this is due to using TC instead of explorer.
                            Sam_Zen
                            I was only repeating what Microsoft themselves say they have done. See http://support.microsoft.com/kb/319827
                            I skipped XP on the way to Vista so cannot be sure exactly when the changes were made. I do not have TC but, as far as I can see, Free Commander still uses Win2000 sort order.

                            Comment


                              #15
                              Originally posted by Mij View Post
                              Free Commander still uses Win2000 sort order.
                              FreeCommander does use the traditional sort order. However, if one wants to use this sorting method he has to pad the numbers in the file names to get numerical order. The problem is there is no easy way to do that. Batch Rename and Multi Rename do not know how, they can only renumber.

                              While FreeCommander does match Windows functionality very closely, it doesn't do everything Windows can.

                              Comment

                              Working...
                              X