cli: encoding-related fixes for --debug option