reads in a file and ignores unrecognized bytes