For future proofing, it would be good to encode each category on its
own, in such a way that related categories are grouped together
numerically. Perhaps the lowercase and uppercase letters, which need
case-changing tables, should still be last in the encoding.