[PATCH] Send HTTP headers with charset utf-8.

  • Done
  • quality assurance status badge
Details
2 participants
  • Arun Isaac
  • Felix Lechner
Owner
unassigned
Submitted by
Felix Lechner
Severity
normal
F
F
Felix Lechner wrote on 13 May 06:38 +0200
(address . bug-mumi@gnu.org)(name . Felix Lechner)(address . felix.lechner@lease-up.com)
20240513043832.6959-1-felix.lechner@lease-up.com
In most cases, providing HTTP headers with the charset is superior
to (and has precedence over) the declaration in an HTML <meta> tag:


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

Toggle diff (23 lines)
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
F
F
Felix Lechner wrote on 15 May 01:15 +0200
(no subject)
(address . control@patchwise.org)
87a5ksvvcc.fsf@lease-up.com
block 69381 by 70906 70907
tags 69381 + patch
thanks
A
A
Arun Isaac wrote on 8 Jun 00:43 +0200
Re: [PATCH] Send HTTP headers with charset utf-8.
(address . 70906-done@debbugs.gnu.org)(name . Felix Lechner)(address . felix.lechner@lease-up.com)
87v82kfk7c.fsf@systemreboot.net
Applied, thanks!

I made the following modifications:
- The application/json MIME type does not require a charset. See
So, I dropped that part.
- I removed the Content-Type meta tag from the HTML.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 70906@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 70906
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch