Use Content-Type to get the charset, close #2188