detect text encoding, like python chardet, but for go