TST: open the TemporaryFile in ASCII mode

This should fix gh-3165.
Merge pull request #3166 from certik/fix3165

TST: open the TemporaryFile in ASCII mode