code: def read(path, encoding="utf-8"):
      
      with open(path, "rb") as f:
          content = f.read()
          try:
              text = content.decode(encoding)
          except:
              res = chardet.detect(content)
              text = content.decode(res["encoding"])
      return text
docs: Auto-decoding string reader.
  
      Usage::
  
          >>> from angora.dataIO import textfile
          or
          >>> from angora.dataIO import *
          >>> textfile.read("test.txt")