Close #22882. Fixed `UnicodeDecodeError`s in commands.

Idem.