GNU bug report logs - #69381
mumi does not correctly display (some?) non-ascii characters

Previous Next

Package: mumi;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Sun, 25 Feb 2024 13:27:03 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 69381 <at> debbugs.gnu.org (full text, mbox):

From: Felix Lechner <felix.lechner <at> lease-up.com>
To: 69381 <at> patchwise.org
Cc: Tomas Volf <~@wolfsden.cz>, Felix Lechner <felix.lechner <at> lease-up.com>
Subject: [PATCH] Convert HTML to UTF-8 ourselves. (Closes: #69381)
Date: Tue, 14 May 2024 16:12:49 -0700
This fixes a host of encoding issues in Mumi, including the diff
problems that are not mentioned in the bug.  An example is here:

    https://issues.guix.gnu.org/63508#4

The procedure version may one day be more efficient but does not work.
Based on comments in the Guile source code, the procedure style may
one day enable more advanced response formats.  The author is unclear
as to why the procedure does not work.  There may be a complex
interaction involving the response headers.

A preview of this code is live at patchwise.org.

The solution of this bug may depend on the patch in Bug#70907.  This
patch furthermore depends on the patch in Bug#70906, but the solution
of the bug may not.
---
 mumi/web/render.scm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mumi/web/render.scm b/mumi/web/render.scm
index 316ca4c..9b16f8d 100644
--- a/mumi/web/render.scm
+++ b/mumi/web/render.scm
@@ -28,6 +28,7 @@
   #:use-module ((ice-9 textual-ports)
                 #:select (get-string-all put-string))
   #:use-module (ice-9 match)
+  #:use-module (rnrs bytevectors)
   #:use-module (web http)
   #:use-module (web request)
   #:use-module (web response)
@@ -104,13 +105,13 @@
 (define* (render-html sxml #:key (extra-headers '()))
   (values (append extra-headers
                   '((content-type . (text/html (charset . "utf-8")))))
-          (lambda (port)
-            (sxml->html sxml port))))
+          (string->utf8
+           (sxml->html-string sxml))))
 
 (define (render-json json)
   (values '((content-type . (application/json (charset . "utf-8"))))
-          (lambda (port)
-            (scm->json json port))))
+          (string->utf8
+           (scm->json-string json))))
 
 (define (not-found uri)
   (values (build-response #:code 404)
-- 
2.41.0





This bug report was last modified 101 days ago.

Previous Next


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