If you transfer the command from aws cli like this, it will look like this (command and output are dummy).
$ aws s3 ls --recursive bucket/photo/1/
2014-05-06 16:45:30 11979 photo/1/20140506164529_Screenshot 2014-01-28 15.27.48.png
However, if you change it to the following command, for example, it becomes annoying.
$ aws s3 ls --recursive bucket/photo/1/ | tee /dev/null
2014-05-06 16:45:30 11979 photo/1/20140506164529_????????? 2014-01-28 15.27.48.pn
Haunted!
The same phenomenon occurs when the file is output by redirect.
The cause is in the Python implementation that implements the ʻaws` command. Python adjusts the character code according to the output destination, but in the case of redirect or pipe, since the character code of the output destination is not known, it is forced to output in ASCII! !! !! Extra imitation! !! !! </ del>
As a countermeasure, you can define an environment variable / shell variable called PYTHONIOENCODING
.
$ PYTHONIOENCODING=UTF-8 aws s3 ls --recursive bucket/photo/1/ | tee /dev/null
2014-05-06 16:45:30 11979 photo/1/20140506164529_Screenshot 2014-01-28 15.27.48.png
Recommended Posts