On Wed, Mar 2, 2016 at 4:42 PM, R Smith <rsmith at rsweb.co.za> wrote: > > > Personally, unless your space is constrained, I would simply save the > numbers as strings, perhaps Hex or BCD with leading chars and convert as > needed. This would sort correctly without tricks and not do much worse for > space. (Base64 would be even better space-wise but won't sort correct). >
There is an encoding defined in RFC 4648 "Base-N Encodings" that does preserve sort order; it is called Base 32 Encoding with Extended Hex Alphabet. I would think the Base64 alphabet could be rearranged to have the same property. e