in reply to dictionary sorting
Damn... I thought you were going to start a discussion on real dictionary sorting where all sorts of odd rules pertain (and I am not convinced that a computer can do most of them).
In the most simple form you have to decide how spaces will sort. So, does a complete word sort before a partial word. Then you have to make similar decisions about punctuation (keeping a distinction between leading punctuation and punctuation that occurs in a word). Next add the complication of ignored prefixes (does d'Annunzio, Gabrielle sort under d or A?), these rules also may vary depending on whether the thing is a place or person (e.g. Saint Paul, does it sort as p (for Paul, Saint) or s (for the city)?).
I read a few books on this from the library and discovered that the rules are pretty convoluted. Fortunately there appears to be an attempt to make the rules more computer friendly so that the program does not need knowledge of what something is in order to sort it.