From 08d7e3592faa93f508cd7f0c30199fe53c87892b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 24 Sep 2015 21:56:42 +0200 Subject: ui: Gracefully handle Unicode description strings. Fixes . Reported by Alex Kost . * guix/ui.scm (texi->plain-text): Wrap body in 'with-fluids'. * tests/ui.scm ("package-description-string vs. Unicode"): New test. --- guix/ui.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/ui.scm b/guix/ui.scm index 4a3630f242..67dd062a34 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -803,7 +803,10 @@ converted to a space; sequences of more than one line break are preserved." (define (texi->plain-text str) "Return a plain-text representation of texinfo fragment STR." - (stexi->plain-text (texi-fragment->stexi str))) + ;; 'texi-fragment->stexi' uses a string port so make sure it's a + ;; Unicode-capable one (see .) + (with-fluids ((%default-port-encoding "UTF-8")) + (stexi->plain-text (texi-fragment->stexi str)))) (define (package-description-string package) "Return a plain-text representation of PACKAGE description field." -- cgit v1.2.3