Converted from `decode('ASCII')` to `decode(sys.getfilesystemencoding())` where appropriate.
Changing from using `decode` on an object name to using `encode` on a temp
file name. This may be no better, but it reduces the number of changes
from the mainline.