guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/06: channels: Consider news files as UTF-8-encoded by default.


From: guix-commits
Subject: 02/06: channels: Consider news files as UTF-8-encoded by default.
Date: Tue, 9 Aug 2022 11:59:36 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 60e0aae89cbf29f88f110376f911777aac70e8a7
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Aug 9 15:59:09 2022 +0200

    channels: Consider news files as UTF-8-encoded by default.
    
    Partly fixes <https://issues.guix.gnu.org/57039>.
    Reported by Pierre-Henry Fröhring <contact@phfrohring.com>.
    
    Previously, news file would be read using the current locale encoding.
    This could lead to a test failure in 'tests/channels.scm' (in a test
    that expects some Unicode-capable encoding) in case tests were run in a
    non-Unicode locale.
    
    * guix/channels.scm (channel-news-for-commit): Make port for NEWS-FILE
    UTF-8 by default.
---
 guix/channels.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index a5e9d7774d..ad6d3fb8ac 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -1153,7 +1153,11 @@ NEW.  When OLD is omitted or is #f, return all the news 
entries of CHANNEL."
         (if (and news-file (file-exists? news-file))
             (with-repository checkout repository
               (let* ((news    (call-with-input-file news-file
-                                read-channel-news))
+                                (lambda (port)
+                                  (set-port-encoding! port
+                                                      (or (file-encoding port)
+                                                          "UTF-8"))
+                                  (read-channel-news port))))
                      (entries (map (lambda (entry)
                                      (resolve-channel-news-entry-tag repository
                                                                      entry))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]