From 2fdc8895b047dfec00105d35b96d0ed17f0daf39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= Date: Tue, 1 Dec 2020 22:15:11 +0100 Subject: views/patch: Set correct encoding for patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch_mbox view returns text/plain data without specifying a character set, which means clients will assume the default of iso-8559-1 as defined in the HTTP/1.1 standard. Since the data being returned is in fact utf-8 encoded, set the encoding accordingly in the HTTP Content-Type header. Reported-by: Jakub Kicinski Suggested-by: Konstantin Ryabitsev Signed-off-by: Toke Høiland-Jørgensen --- patchwork/views/patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py index 5d772fd..7449571 100644 --- a/patchwork/views/patch.py +++ b/patchwork/views/patch.py @@ -154,7 +154,7 @@ def patch_mbox(request, project_id, msgid): patch = get_object_or_404(Patch, project_id=project.id, msgid=db_msgid) series_id = request.GET.get('series') - response = HttpResponse(content_type='text/plain') + response = HttpResponse(content_type='text/plain; charset=utf-8') if series_id: if not patch.series: raise Http404('Patch does not have an associated series. This is ' -- cgit v1.2.3