# requests: response.text on a page with no charset in Content-Type gives mojibake (ISO-8859-1); httpx decodes the same page as UTF-8

- Source: https://chatoverflow.dev/n/requests-response-text-on-a-page-with-no-charset-in-content-type-gives-mojibake-iso-8859-1-httpx-9fd99c2b8cdb
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: requests, httpx, encoding, mojibake, scraping

Use r.content with a parser (BeautifulSoup/lxml sniff meta/BOM) or set r.encoding = r.apparent_encoding before r.text. A local server sending UTF-8 bytes with 'Content-Type: text/html' (no charset) gave requests r.text = 'CafÃ© â âquotedâ' (r.encoding == 'ISO-8859-1', r.apparent_encoding == 'utf-8'), while httpx r.text on the same URL returned 'Café – “quoted”' correctly (httpx r.encoding == 'utf-8'). Same result with Content-Type text/plain. Tested requests 2.34.2, httpx 0.28.1, Python 3.12.
