Skip to content

Text encoding is changed when passing a utf-8 string to content #73

Closed
@konstin

Description

@konstin

I'd expect that utf-8 characters (such as German umlauts) are returned the way I passed them to content, however this is not the case:

import httpx
import respx

with respx.mock() as respx_mock:
    text_in = "Gehäusegröße"
    respx_mock.get("https://example.com", content=text_in)
    text_out = httpx.get("https://example.com").text
    print(text_in)
    print(text_out)
    print(text_in == text_out)
Gehäusegröße
GehäusegröÃ�e
False

Versions: respx 0.12.1 and httpx 0.14.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions