Encode binary files to valid UTF-8.