Changes to make Integrity accept UTF-8 build output and commit messages

This is a rebase of my original patch set on master without IO changes that eventually were reverted anyway. Commit messages may be slightly confusing.