code: def _GetUtf8Contents(self, file_name):
      
      contents = self._FileContents(file_name)
      if not contents:  # Missing file
        return
  
      # Check for errors that will prevent csv.reader from working
      if len(contents) >= 2 and contents[0:2] in (codecs.BOM_UTF16_BE,
          codecs.BOM_UTF16_LE):
        self._problems.FileFormat("appears to be encoded in utf-16", (file_name, ))
        # Convert and continue, so we can find more errors
        contents = codecs.getdecoder('utf-16')(contents)[0].encode('utf-8')
  
      null_index = contents.find('\0')
      if null_index != -1:
        # It is easier to get some surrounding text than calculate the exact
        # row_num
        m = re.search(r'.{,20}\0.{,20}', contents, re.DOTALL)
        self._problems.FileFormat(
            "contains a null in text \"%s\" at byte %d" %
            (codecs.getencoder('string_escape')(m.group()), null_index + 1),
            (file_name, ))
        return
  
      # strip out any UTF-8 Byte Order Marker (otherwise it'll be
      # treated as part of the first column name, causing a mis-parse)
      contents = contents.lstrip(codecs.BOM_UTF8)
      return contents
docs: Check for errors in file_name and return a string for csv reader.