summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-09-24 21:56:42 +0200
committerLudovic Courtès <ludo@gnu.org>2015-09-24 22:04:51 +0200
commit08d7e3592faa93f508cd7f0c30199fe53c87892b (patch)
tree9cd4ae44427b5e4466fbad91e530445a07282d85 /guix
parent75726135ce017f37ae57181e011ceea95c56dd3a (diff)
ui: Gracefully handle Unicode description strings.
Fixes <http://bugs.gnu.org/21536>. Reported by Alex Kost <alezost@gmail.com>. * guix/ui.scm (texi->plain-text): Wrap body in 'with-fluids'. * tests/ui.scm ("package-description-string vs. Unicode"): New test.
Diffstat (limited to 'guix')
-rw-r--r--guix/ui.scm5
1 files changed, 4 insertions, 1 deletions
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 <http://bugs.gnu.org/11197>.)
+ (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."