all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Felix Lechner via Bug-mumi via "Bug reports for GNU Guix Mumi." <bug-mumi@gnu.org>
To: 70906@debbugs.gnu.org
Cc: Felix Lechner <felix.lechner@lease-up.com>
Subject: bug#70906: [PATCH] Send HTTP headers with charset utf-8.
Date: Sun, 12 May 2024 21:38:32 -0700	[thread overview]
Message-ID: <20240513043832.6959-1-felix.lechner@lease-up.com> (raw)

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





             reply	other threads:[~2024-05-13  4:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13  4:38 Felix Lechner via Bug-mumi via Bug reports for GNU Guix Mumi. [this message]
2024-06-07 22:43 ` bug#70906: [PATCH] Send HTTP headers with charset utf-8 Arun Isaac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240513043832.6959-1-felix.lechner@lease-up.com \
    --to=bug-mumi@gnu.org \
    --cc=70906@debbugs.gnu.org \
    --cc=felix.lechner@lease-up.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.