validate config file encoding when containing non-ascii characters

Fixes #1468