ui: Don't use '%default-port-encoding' to set the encoding of string ports.
* guix/ui.scm (right-arrow): Call 'set-port-encoding!' to set PORT's encoding; remove use of 'with-fluids'. This is for compatibility with Guile 2.2 where the encoding of string ports is not influenced by %DEFAULT-PORT-ENCODING. * tests/ui.scm ("show-manifest-transaction"): Likewise.
This commit is contained in:
parent
30906825cb
commit
1062063a65
|
@ -635,16 +635,17 @@ report what is prerequisites are available for download."
|
||||||
(define (right-arrow port)
|
(define (right-arrow port)
|
||||||
"Return either a string containing the 'RIGHT ARROW' character, or an ASCII
|
"Return either a string containing the 'RIGHT ARROW' character, or an ASCII
|
||||||
replacement if PORT is not Unicode-capable."
|
replacement if PORT is not Unicode-capable."
|
||||||
(with-fluids ((%default-port-encoding (port-encoding port)))
|
(let ((encoding (port-encoding port))
|
||||||
(let ((arrow "→"))
|
(arrow "→"))
|
||||||
(catch 'encoding-error
|
(catch 'encoding-error
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(call-with-output-string
|
(call-with-output-string
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
|
(set-port-encoding! port encoding)
|
||||||
(set-port-conversion-strategy! port 'error)
|
(set-port-conversion-strategy! port 'error)
|
||||||
(display arrow port))))
|
(display arrow port))))
|
||||||
(lambda (key . args)
|
(lambda (key . args)
|
||||||
"->")))))
|
"->"))))
|
||||||
|
|
||||||
(define* (show-manifest-transaction store manifest transaction
|
(define* (show-manifest-transaction store manifest transaction
|
||||||
#:key dry-run?)
|
#:key dry-run?)
|
||||||
|
|
|
@ -248,9 +248,12 @@ Second line" 24))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(show-manifest-transaction store m t)))))
|
(show-manifest-transaction store m t)))))
|
||||||
(string-match "guile\t1.8.8 -> 2.0.9"
|
(string-match "guile\t1.8.8 -> 2.0.9"
|
||||||
(with-fluids ((%default-port-encoding "ISO-8859-1"))
|
|
||||||
(with-error-to-string
|
(with-error-to-string
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(show-manifest-transaction store m t)))))))))
|
;; In Guile 2.2, %DEFAULT-PORT-ENCODING doesn't
|
||||||
|
;; influence the encoding of string ports.
|
||||||
|
(set-port-encoding! (current-error-port)
|
||||||
|
"ISO-8859-1")
|
||||||
|
(show-manifest-transaction store m t))))))))
|
||||||
|
|
||||||
(test-end "ui")
|
(test-end "ui")
|
||||||
|
|
Loading…
Reference in New Issue