This question is answered. Helpful answers available: 0. Correct answers available: 1.


Permlink Replies: 20 - Pages: 2 [ 1 2 | Next ] - Last Post: 15 Jul 25, 11:54 Last Post By: RobM
peterverm

Posts: 3
Registered: 2-Sep-2017
JAlbum image sort order with underscore
Posted: 9 Jul 25, 08:22
 
  Click to reply to this thread Reply
Hallo,

strange question i think.

I name my images yymmdd_hhmmss or : day underscore ( _ ) time.

Now i have an album with 2 activities in parallel. Hence, i want to group each activity and for some images, i have put 2 underscores ( __ ) between day and time. The activity with 2 underscores should come first in the album.

In file explorer, this sorts just right : _, 0, 1, 2, ... : the underscore comes first.

But in JAlbum, it sorts differently : 0, 1, 2, ..., _ : the underscore comes last.

See print screen in attachment, it is a simplified example, but i would expect

01__01_PVE
01__02_PVE
01__03_PVE
01_01_PVE
01_02_PVE
01_03_PVE
02_01_PVE

in JAlbum as well.

I tried "name" and "name (simple)" in settings/Pages/Image ordering, but this makes no difference.

Is there a setting that i should change ?

Thanks for helping me out,

Regards,

Peter
RobM

Posts: 3,950
Registered: 4-Aug-2006
Re: JAlbum image sort order with underscore
Posted: 9 Jul 25, 12:32   in response to: peterverm in response to: peterverm
 
  Click to reply to this thread Reply
You could use custom ordering and drag the images to the positions you want. You could use subfolders instead of extra underscores.
peterverm

Posts: 3
Registered: 2-Sep-2017
Re: JAlbum image sort order with underscore
Posted: 9 Jul 25, 15:05   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
i agree, but still : why does JAlbum sort differently ?
JeffTucker

Posts: 8,098
Registered: 31-Jan-2006
Re: JAlbum image sort order with underscore
Posted: 9 Jul 25, 15:08   in response to: peterverm in response to: peterverm
Helpful
  Click to reply to this thread Reply
In the ASCII character set, underscore sorts after the numerals and upper-case letters, and before the lower-case letters. The underscore is ASCII 95, whereas the numerals are ASCII 48-57, the upper-case letters are ASCII 65-90, and the lower-case letters are ASCII 97-122.

It would appear that File Explorer is doing its own thing, and Finder does the same!
JeffTucker

Posts: 8,098
Registered: 31-Jan-2006
Re: JAlbum image sort order with underscore
Posted: 9 Jul 25, 15:10   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Attachment ascii.png (40.5 KB)
Here's a simplified chart.
davidekholm

Posts: 3,711
Registered: 18-Oct-2002
Re: JAlbum image sort order with underscore
Posted: 9 Jul 25, 16:37   in response to: JeffTucker in response to: JeffTucker
Helpful
  Click to reply to this thread Reply
Amazing that we haven't had this request earlier. jAlbum tries to do a somewhat more clever ordering than pure ASCII ordering: It's case insensitive and it handles numbers correctly so 10 is ordered after 2, for instance, but as Jeff pointed out it orders special characters like underscore after numbers. This makes jAlbum's ordering differ from both Finder (Mac) and Windows Explorer. The intention for jAlbum's behaviour has always been to be as close to these file managers as possible (rule of least surprise). I'll therefore update the upcoming jAlbum 37.7 to order underscores and special characters before numbers and characters. Stay tuned.
JeffTucker

Posts: 8,098
Registered: 31-Jan-2006
Re: JAlbum image sort order with underscore
Posted: 9 Jul 25, 16:54   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
The ASCII sequence certainly has some interesting bits of perversity. Besides the "sort to the end" characters like underscore, there's also a run of special characters that appears between 0-9 and A-Z!

I agree that the sort sequence should mimic File Explorer, in any event, even though it makes it difficult to come up with file names that automatically sort to the end. You're left with "zzz" combinations, because all of the displayable special characters come earlier. While it is possible to use some Unicode characters, that should be discouraged, for obvious reasons.

Both File Explorer and Finder also tinker with casing. They're sensitive to case, but the sort sequence goes, for example, A01, a01, B01, b01, etc.

ETA: Not quite accurate. File Explorer still doesn't differentiate between A01 and a01, regarding them as duplicates. It's amazing that they've stubbornly stuck to that.
davidekholm

Posts: 3,711
Registered: 18-Oct-2002
Re: JAlbum image sort order with underscore
Posted: 9 Jul 25, 17:26   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Here's a beta for you to try that has a more clever name ordering:

https://jalbum.net/download/beta/jalbum-core.jar
(Put it inside jAlbum's lib folder, thereby replacing the existing jalbum-core file.

Changes:
  • Name ordering is now closer to Windows Explorer and Finder
  • Name ordering is now also locale aware. For instance, if jAlbum is set to Swedish, it will order åäö after z, but if set to English, it will be aaoz (i.e. treating the a-ring and umlauts as accents to a and o)
  • Polished UI a bit (uses less and more sublime lines, making more look and feels appealing now)
  • Presents the image(s) being dragged as a drag-image during drag and drop
JeffTucker

Posts: 8,098
Registered: 31-Jan-2006
Re: JAlbum image sort order with underscore
Posted: 9 Jul 25, 17:40   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
This isn't mimicking File Explorer.

File Explorer:

01__01_PVE
01__02_PVE
01__03_PVE
01_01_PVE
01_02_PVE
01_03_PVE
02_01_PVE

jAlbum:

01_01_PVE
01_02_PVE
01_03_PVE
01__01_PVE
01__02_PVE
01__03_PVE
02_01_PVE

In short, underscore isn't consistently sorting before numerals.
davidekholm

Posts: 3,711
Registered: 18-Oct-2002
Re: JAlbum image sort order with underscore
Posted: 10 Jul 25, 13:02   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Thanks for pointing that out Jeff. After 25 (or so) back-and-forth with Chat GPT, I now believe it behaves correctly (b2)
JeffTucker

Posts: 8,098
Registered: 31-Jan-2006
Re: JAlbum image sort order with underscore
Posted: 10 Jul 25, 14:41   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
That appears to work, at least for the case presented by the OP. I'll see if I can book some time with the JeffBot™ for more extensive testing, but it's tough to get an appointment.
RobM

Posts: 3,950
Registered: 4-Aug-2006
Re: JAlbum image sort order with underscore
Posted: 10 Jul 25, 21:49   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Just tried the update. -1.jpg comes first, _1.jpg comes second and 1.jpg comes third.
Should 1.jpg come before _1.jpg?

Edited by: RobM on 10 Jul 2025, 20:50
Finder shows _1.jpg then -1.jpg and last 1.jpg
JeffTucker

Posts: 8,098
Registered: 31-Jan-2006
Re: JAlbum image sort order with underscore
Posted: 10 Jul 25, 22:08   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
File Explorer:

_1.jpg
1.jpg
-1.jpg

Fun for the whole family.

But if you're going to put the special characters before the regular characters, 1.jpg should be last, not first. The dash and underbar should sort before the numerals.

If you're preserving the relative positions of the special characters, but putting them all before the regular numerals and letters, it should be:

-1.jpg
_1.jpg
1.jpg

Dash, ASCII 45, comes before underscore, ASCII 95. Both come before the numeral one.
JeffTucker

Posts: 8,098
Registered: 31-Jan-2006
Re: JAlbum image sort order with underscore
Posted: 10 Jul 25, 22:11   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Of course, a leading dash would make me nervous, since jAlbum uses a minus to indicate an excluded image file in albumfiles.txt. A file name with that character seems to work, but I'm not sure how.
RobM

Posts: 3,950
Registered: 4-Aug-2006
Re: JAlbum image sort order with underscore
Posted: 10 Jul 25, 23:20   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
I merely threw it in as a simple trial, rather than embedding the underscore and minus within the file name. If Finder and File Explorer don't have the same result my conclusion would be it is arbitrary, there is no 'right way'.

In the old old days (ten years ago), a leading underscore in the file name resulted in the file being excluded.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums