bug fix detectFileEncoding when connection object is inputted