Skip to content

Commit d3adfd8

Browse files
committed
Fixed wrong content length for multibyte characters
1 parent d0d5b80 commit d3adfd8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

adafruit_httpserver/response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _construct_response_bytes( # pylint: disable=too-many-arguments
7373
response = f"{http_version} {status.code} {status.text}\r\n"
7474

7575
headers.setdefault("Content-Type", content_type)
76-
headers.setdefault("Content-Length", content_length or len(body))
76+
headers.setdefault("Content-Length", content_length or len(body.encode("utf-8")))
7777
headers.setdefault("Connection", "close")
7878

7979
for header, value in headers.items():

0 commit comments

Comments
 (0)