GNU bug report logs - #70906
[PATCH] Send HTTP headers with charset utf-8.

Previous Next

Package: mumi;

Reported by: Felix Lechner <felix.lechner <at> lease-up.com>

Date: Mon, 13 May 2024 04:39:02 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Felix Lechner <felix.lechner <at> lease-up.com>
To: 70906 <at> debbugs.gnu.org
Cc: Felix Lechner <felix.lechner <at> lease-up.com>
Subject: bug#70906: [PATCH] Send HTTP headers with charset utf-8.
Date: Sun, 12 May 2024 21:38:32 -0700
In most cases, providing HTTP headers with the charset is superior
to (and has precedence over) the declaration in an HTML <meta> tag:

    https://stackoverflow.com/a/26032993

A preview of this code is live at patchwise.org.
---
 mumi/web/render.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mumi/web/render.scm b/mumi/web/render.scm
index ad3ae0e..e867178 100644
--- a/mumi/web/render.scm
+++ b/mumi/web/render.scm
@@ -103,12 +103,12 @@
 
 (define* (render-html sxml #:key (extra-headers '()))
   (values (append extra-headers
-                  '((content-type . (text/html))))
+                  '((content-type . (text/html (charset . "utf-8")))))
           (lambda (port)
             (sxml->html sxml port))))
 
 (define (render-json json)
-  (values '((content-type . (application/json)))
+  (values '((content-type . (application/json (charset . "utf-8"))))
           (lambda (port)
             (scm->json json port))))
 

base-commit: 99416ed5c7d950eaf54d52023a2efd975bccac92
-- 
2.41.0





This bug report was last modified 1 year and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.