better pack_commands algorithm with less string joining
Consistent option names for encoding and encoding_errors. Fixes #510