Using funny characters in Outlook 2007 folder and category names – what’s the sort order?

It’s common to use “funny characters” (i.e., non-alphabetic symbols) in Outlook folder names, so that the folders sort in a specific order:

!!Super Important
All A’s
Basically B’s

Of course, the same principle can be applied to category names:

Project A
Project B

But how can you be sure that “!Important” will come before “@Home”? In other words, what’s the sort order? This bugged me enough to sit down and work it out. So here’s the sort order in Outlook 2007 (American English) for the symbols from an American standard keyboard layout:

  ! ” # $ % & ( * , . / : ; @ [ ] ^ _ { | } ~ + < = >
then all the numbers
then all the letters

The hyphen and single quote are (almost) ignored, in that -A sorts after A but before B, and ‘B sorts after B but before C. And yes, that’s a space character before the ! character, so putting a space at the front of a folder name will make it sort to the very top. Sadly, there seems to be no special character that forces a folder to sort to the bottom of the list.

I’m sure there is an official name and explanation for this sort order, but my search engine fu has failed me. Help me, oh lazyweb!

Comments (9)

  1. Tony H says:

    Hi Jon,

    The official name and explanation for this sort order is the wonderful ASCII codes. Basically the ASCII code go like this:

    ! = 033 (ASCII) = 21 (HEX)

    " = 034 (ASCII) = 22 (HEX)

    ! is the first printable or non-control character, all the way to 126 or 7F for printable characters.  Not sure why the hyphen behaves as it does, so the sort order (if sorting by ASCII) should sort ZFolder before afolder as it’s higher in the pecking order (I’ve not tested if this is the case or not).

    You can find all of the codes in all of their glorious 8 bitness somewhere like this:


  2. Yes, it’s got some ASCII ordering in there, but there’s a lot that’s not the same:

    1. The four symbol ranges in ASCII have been coalesced into one, so that *all* symbols now sort before *all* alphanumerics…

    2. …with the exception of the hyphen and single-quote (and why the single-quote and not the double-quote?)…

    3. …and the coalescing didn’t even respect ASCII order. For example, the subsequence "< = >" comes before "{ | }" in ASCII, but after it in Outlook sort order.

    I’m sure somewhere there’s a PM with a spec and a reason for why this is the way it is – I just want to find that spec 🙂

  3. John says:

    Thanks for the post. I was wondering why the ASCII order seemed to be out the window.

  4. Thank you, Jonathan for all that tedious work.

    Our purposes in knowing the sorting order of keyboard characters were almost the same:   labeling/ naming folders so they sort in a specific order.  I had ALL computer file directories in mind, viz., My Computer/ Windows Explore & their relatives.  I hope you were faster than I.  9-1-2007 I typed out all characters which I could remember (rather than downloading keyboards full thereof, and sorted individual characters in Word Perfect.  It took me AGES, so you know I can appreciate your diligence.

    I know that work was saved 9-1-2007.  Well, so I believed!  Frequently I copy basic text from WordPerfect or other programs onto Notepad .txt files and delete the much more consumptive files.  That’s so the files do not consume so much storage "space".  When I looked for a .txt file re. ‘Character sorting order’ today, the text file page was blank!  Ugh!  My Search Companion is not working right now, so did not want to spend another hour or so looking for a .wpd doc which might (likely) have gotten deleted.

    Then thought of the world of persons who might have already done such work.  Yes, Googling ‘Keyboard character sorting order’ led me to your blog and to bliss!

    You have it all right there on three lines!

    And I have those lines on a .txt doc named

       Character sorting order.txt

    Making a shortcut for my desktop ‘Shortcuts’  folder, then making another shortcut and changing its name to

         ! " # $ % & ( * , . / : ; @ [ ] ^ _ { | } ~ + < = >

    (beginning with two spaces) for the desktop makes the order visible

  5. Roman says:

    Single Quote can be used as part of a name, thus attempts at honoring the alphabet.

  6. RBM says:

    Can you sort Outlook 2007 by categories even when there are multiple categories assigned to one entry?  It’s not possible in Outlook 2003.

  7. MDS says:

    Thanks for posting this.

    The frustrating thing about this sort order is that there is no option for putting non-alphabetic folders at the end. Some folders are really important and need to be at the top.  Others are really unimportant and need to be at the bottom.  And sometimes both are really important but its also very important not to misfile. Thus the desire for space.

  8. billyjeanbobbit says:

    Wow .. .long time coming but here is how I solved this crazy sort order thing. I said FORGET IT!

    I created a custom field, then displayed it as a column. I also played with the form editing in order to add it to a new tab on Tasks. (Unfortunately I couldn't figure out how to put the new field within the exisiting main tab!)

    I have in-field editing turned on in all of my task views.. so I can quickly enter, edit, see and sort the number there. When sorting by this field .. its just the same as having a symbol as the first character of the name and sorting by it .. except this way I dont have to remember that crazy order of sorting… and you can choose to sort by all the other ways in different views or by clicking the columns.

    I use numbers first and sometimes repeating numbers or adding a letter to sort exactly the way I want. It is very easy to build a tree-like priority system this way. Works great for me!!

    I have actually just wiped out my custom field across the database .. to force myself to analyze each task and mentally review it while I figure out its current priority. I may have to automate this.

    Hope this helps someone!