From: Felix Lechner via Bug-mumi via "Bug reports for GNU Guix Mumi." <bug-mumi@gnu.org>
To: 69381@patchwise.org
Cc: Tomas Volf <~@wolfsden.cz>, Felix Lechner <felix.lechner@lease-up.com>
Subject: bug#69381: [PATCH] Convert HTML to UTF-8 ourselves. (Closes: #69381)
Date: Tue, 14 May 2024 16:12:49 -0700 [thread overview]
Message-ID: <20240514231249.18303-1-felix.lechner@lease-up.com> (raw)
In-Reply-To: <Zds6yhPkZ0Id6SAT@ws>
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
next prev parent reply other threads:[~2024-05-14 23:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-25 13:04 bug#69381: mumi does not correctly display (some?) non-ascii characters Tomas Volf
2024-05-14 23:12 ` Felix Lechner via Bug-mumi via Bug reports for GNU Guix Mumi. [this message]
2024-11-02 0:07 ` bug#69381: [PATCH] web: Use string to avoid losing unicode characters noe--- via Bug-mumi via Bug reports for GNU Guix Mumi.
2024-11-02 0:14 ` Noé Lopez via Bug-mumi via Bug reports for GNU Guix Mumi.
2024-11-02 2:23 ` Noé Lopez via Bug-mumi via Bug reports for GNU Guix Mumi.
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=20240514231249.18303-1-felix.lechner@lease-up.com \
--to=bug-mumi@gnu.org \
--cc=69381@patchwise.org \
--cc=felix.lechner@lease-up.com \
--cc=~@wolfsden.cz \
/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.