From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id uL0zOEbwQ2YlXQAAqHPOHw:P1 (envelope-from ) for ; Wed, 15 May 2024 01:14:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id uL0zOEbwQ2YlXQAAqHPOHw (envelope-from ) for ; Wed, 15 May 2024 01:14:15 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b="m/rujQsK"; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b="m/rujQsK"; spf=pass (aspmx1.migadu.com: domain of "bug-mumi-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-mumi-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1715728454; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vzKqJhpTyEUeS16MXNkcutwIt8BLBTMqyk6QZAIo2s4=; b=a4GBpzBk+71A1uZ4m1UhHNSCoBKCpdOAINgw6D1/qHb9au+u3Hj+kseaFdBGUCJ8LqY1/c zrnjli89SKPqq5qHwskCLk1MeXAnjtzdCQcIujnQzyG826K+0uv+YQwWMsRZGczvRvvVxW nLTty7aaqv4GVbjFrLhPSo/RqinNd0JXhLFaUgYwfhNQjj8PvfVZN9qf3miEcIoHea2pHb +V0E8LWK7D/tYNBSlilDkBRESbpPytU3kHdOymGH+a54RDefvX/YYzGBItAusIwSnkIDoj w40guJLvMfD0qnr4HB1NCpFnUWssdnSz2+Lj0r0iCFmZnqip4gRGBQpyDIGc5Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b="m/rujQsK"; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b="m/rujQsK"; spf=pass (aspmx1.migadu.com: domain of "bug-mumi-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-mumi-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715728454; a=rsa-sha256; cv=none; b=Vk3s7IAM+riP+/sdcQ6wMimRkGiSDyGsydMhd+KEtKBBDkIi9hCygc8oorOnp3oF+fjv9M A+U7i07EO7NZq+xI7OaKEq9syN3fahkHsqssDsOLT57VpgfPCel9QQdMuImPuz0lCITXKG iTZQJ1AQq82Fp0sk8AfN4nKlgutXhrSEAAa3DxZqsVDStuP/MmgJIrjslnzKV4jpXjE5YQ AwrF03RUSV1Rs6IKuU2j6MSKEXmeElcbHluo19NDxHz2ebIJyW1bRoEAIrWOcqFpX44emf XtLq5XPzAzYboGryBbdNCYQowrd6ogXSgaSFdQ+AzdBXdWhoUsW6kwdNrq0BYA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 220C67CFFF for ; Wed, 15 May 2024 01:14:13 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s71LO-0006zX-O5; Tue, 14 May 2024 19:14:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s71LN-0006zH-43 for bug-mumi@gnu.org; Tue, 14 May 2024 19:14:01 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s71LM-0005ZX-SM for bug-mumi@gnu.org; Tue, 14 May 2024 19:14:00 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s71LN-00011X-So for bug-mumi@gnu.org; Tue, 14 May 2024 19:14:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#69381: [PATCH] Convert HTML to UTF-8 ourselves. (Closes: #69381) References: In-Reply-To: Resent-From: Felix Lechner Original-Sender: "Debbugs-submit" Resent-CC: bug-mumi@gnu.org Resent-Date: Tue, 14 May 2024 23:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69381 X-GNU-PR-Package: mumi X-GNU-PR-Keywords: To: 69381@patchwise.org Cc: Tomas Volf <~@wolfsden.cz>, Felix Lechner Received: via spool by 69381-submit@debbugs.gnu.org id=B69381.17157284023906 (code B ref 69381); Tue, 14 May 2024 23:14:01 +0000 Received: (at 69381) by debbugs.gnu.org; 14 May 2024 23:13:22 +0000 Received: from localhost ([127.0.0.1]:41549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s71Kk-00010w-9d for submit@debbugs.gnu.org; Tue, 14 May 2024 19:13:22 -0400 Received: from sail-ipv4.us-core.com ([208.82.101.137]:45434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s71Kf-00010n-62 for 69381@debbugs.gnu.org; Tue, 14 May 2024 19:13:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=MxeHZHe/XILKnAa imE2YqfFjMMmI3L4PdH4MsWmW7f0=; h=date:subject:cc:to:from; d=lease-up.com; b=m/rujQsKl7HdvG7O5801TGGyOeBVAzBfT2tRsZz8BfVBXO1ig2Bx dTXLoJVYAeXjX6ffk3tmeoncVfmZZaMXhQ0+eQugHvLNG2wjoEzLnNw7dLAJDO3WgIe7jH i9nI1GkEK3LhT6z0JG298G+j2soZOHwO6xG+gyNlxgK501BYc= Received: by localhost (OpenSMTPD) with ESMTPA id e8f248be for <69381@debbugs.gnu.org>; Tue, 14 May 2024 23:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=MxeHZHe/XILKnAa imE2YqfFjMMmI3L4PdH4MsWmW7f0=; h=date:subject:cc:to:from; d=lease-up.com; b=m/rujQsKl7HdvG7O5801TGGyOeBVAzBfT2tRsZz8BfVBXO1ig2Bx dTXLoJVYAeXjX6ffk3tmeoncVfmZZaMXhQ0+eQugHvLNG2wjoEzLnNw7dLAJDO3WgIe7jH i9nI1GkEK3LhT6z0JG298G+j2soZOHwO6xG+gyNlxgK501BYc= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id b9008797 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Tue, 14 May 2024 23:13:14 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 66a71495; Tue, 14 May 2024 23:13:13 +0000 (UTC) Date: Tue, 14 May 2024 16:12:49 -0700 Message-ID: <20240514231249.18303-1-felix.lechner@lease-up.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-mumi@gnu.org List-Id: "Bug reports for GNU Guix Mumi." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Bug-mumi From: Felix Lechner via Bug-mumi via "Bug reports for GNU Guix Mumi." Errors-To: bug-mumi-bounces+larch=yhetil.org@gnu.org Sender: bug-mumi-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -6.37 X-Migadu-Queue-Id: 220C67CFFF X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -6.37 X-TUID: NxgJ8abUlxVK 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