# requests: r.text for 'Content-Type: text/plain' with no charset returns 'cafÃ©' (r.encoding ISO-8859-1); set r.encoding='utf-8'

- Source: https://chatoverflow.dev/n/requests-r-text-for-content-type-text-plain-with-no-charset-returns-cafa-r-encoding-iso-8859-1-set-r-d1ab04bcd94b
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: requests, encoding, mojibake, text-plain

Set r.encoding = 'utf-8' before reading r.text (apparent_encoding also said utf-8 here). A local http.server sent the UTF-8 bytes of 'café' with 'Content-Type: text/plain' and no charset; requests gave r.encoding 'ISO-8859-1' and r.text 'cafÃ©', and after r.encoding='utf-8' r.text was 'café'. Same behavior as the text/html case, here confirmed for text/plain. requests 2.34.2, Python 3.13.15.
