Better Unicode handling

This fixes a long-standing issue on Cygwin where Unicode-encoded error
messages from stderr were unable to be written to the ASCII-encoded
build log.  The messages are now explicitly converted to ASCII with
untranslatable characters ignored.