Re: [Nautilus-list] bug or feature? file list order



Thanks for the long answer!
It's great how you can learn something new every day trying to
understand Linux :-))

I changed the LC_COLLATE and got the expected behaviour back


Jens


On 26 May 2001 00:46:43 +0200, Christian Rose wrote:
> Jens Ansorg wrote:
> > just noticed an something odd:
> > 
> > i have some files and directories whose names start with _ (underscore)
> > 
> > Now, nautilus kind of ignores this "letter" and sorts the files/dirs
> > using the following letter, i.e.
> > 
> > admin
> > cgi-bin
> > _diary
> > graphics
> > _links
> > styles
> > _travel
> > 
> > what I would expect is an sort order like
> > 
> > _diary
> > _links
> > _travel
> > admin
> > cgi-bin
> > ... etc.
> > 
> > at least that seems logical to me and that's what I'm used from other
> > OSes
> > 
> > any chance to change this behaviour?
> 
> Short answer: Feature.
> 
> Long answer: Nautilus is using the sorting rules from your glibc locale
> for sorting. If you are using de_DE (type "locale" in a console if you
> are unsure), you most likely also have German sorting. And with sorting
> is meant "strict lexigraphical sorting", the type of sorting that has
> been used by librarians for several centuries, not some invented scheme
> like the old C rules previously commonly used in the UNIX world.
> 
> I only know the Swedish (sv_SE) sorting rules, but I believe they are
> similar to the German ones.
> First of all, sorting is not case-sensitive. A file named "Testfile" and
> one named "testfile" will be sorted immediately next to each other, no
> matter how many other files there are in the directory. Exactly the way
> it is done in a literature index.
> Secondly, non-alphabetic and non-numeric characters make no difference
> to sorting. In the lexigraphical sense, these characters simply have no
> internal ordering, and cannot be sorted. They are removed from the
> string that is to be sorted, so that the sorting can be based on the
> symbols that can actually be sorted. So the ignoring of the underscore
> in your example with regards to sorting is entirely correct.
> 
> If you are used to the old UNIX way of sorting from other operating
> systems, even though you used German on those, well then those operating
> systems were simply broken in this aspect.
> 
> 
> If you still want the other behavior, it should be simple to fix. Most
> locale stuff is controlled by the LC_* environment variables. LC_COLLATE
> is the one that controls sorting, so you can choose sorting preference
> independantly from language preference, for example.
> 
> To select C sorting in an otherwise de_DE environment:
> 
> unset LC_ALL          # LC_ALL "sets all" the LC_* variables to
>                       # the same value, since you want different
>                       # values we have to unset this one
> export LC_COLLATE=C   # Set sorting preference to the C "locale",
>                       # a sorting identical to ASCII sorting
> locale                        # To verify that variables were set as
>                       # expected
> 
> 
> You can put this (except for the "locale" command) in your login script,
> and the next time you login Nautilus should hopefully sort as you're
> used to.
> 
> 
> Christian





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]