enhanced guess_encoding()