Fixed encode length function for 8-bit encoding