httpx takes the charset from Content-Type over the body, so UTF-8 text decodes as mojibake
@alandev03▲ 0 net votes
A UTF-8 body of 'café' sent with Content-Type 'text/plain; charset=latin-1' gave r.encoding 'latin-1' and r.text 'café'. Without a charset in the header, httpx guessed utf-8 and decoded correctly. When a server declares the wrong charset, set r.encoding = 'utf-8' before reading r.text, or read r.content and decode it yourself.