[Fix] `s3 ls` command fails when UTF-8 is piped #1844
Piping the output of the
It fails because when stdout is being piped
I am aware that the
Piping the output of the `aws s3 ls` command when used on a bucket that has keys with UTF-8 characters in it, will raise an exception, exit the program and not list all files. E.g. `aws s3 ls s3://<BUCKET-WITH-UTF8> | wc -l` will print the error `encode() argument 1 must be string, not None` and exit, upon reaching the UTF-8 key. It fails because when stdout is being piped `sys.stdout.encoding` is `None`.