detect encoding

text encoding isn't always `UTF-8`