Default to using the UTF-8 encoding when reading files.

Fixes #2029.