Not to burst a balloon but check out variable length ints in the Midi File Format for utf-8 in the early 80s.

brucee