guix-commits
[Top][All Lists]
Advanced

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

02/02: serialization: Adjust the permissive UTF-8 decoder to Guile 2.0.1


From: Ludovic Courtès
Subject: 02/02: serialization: Adjust the permissive UTF-8 decoder to Guile 2.0.12ish.
Date: Fri, 01 May 2015 11:11:35 +0000

civodul pushed a commit to branch master
in repository guix.

commit bc7d089a9cb5ce843730f863cc03195168a956b9
Author: Ludovic Courtès <address@hidden>
Date:   Fri May 1 13:10:18 2015 +0200

    serialization: Adjust the permissive UTF-8 decoder to Guile 2.0.12ish.
    
    * guix/serialization.scm (read-maybe-utf8-string): Use
      'set-port-encoding!' and 'set-port-conversion-strategy!' instead of
      setting '%default-port-encoding' and
      '%default-port-conversion-strategy'.  This accounts for Guile commit
      d574d96, which changes bytevector input ports to use ISO-8859-1.
---
 guix/serialization.scm |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/guix/serialization.scm b/guix/serialization.scm
index a99f53e..51d7ef7 100644
--- a/guix/serialization.scm
+++ b/guix/serialization.scm
@@ -140,10 +140,9 @@ substitute invalid byte sequences with question marks.  
This is a
   ;; not very efficient.  Eventually Guile may provide a lightweight
   ;; permissive UTF-8 decoder.
   (let* ((bv   (read-byte-string p))
-         (port (with-fluids ((%default-port-encoding "UTF-8")
-                             (%default-port-conversion-strategy
-                              'substitute))
-                 (open-bytevector-input-port bv))))
+         (port (open-bytevector-input-port bv)))
+    (set-port-encoding! port "UTF-8")
+    (set-port-conversion-strategy! port 'substitute)
     (get-string-all port)))
 
 (define (write-string-list l p)



reply via email to

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