GNU bug report logs - #21536
Texi, Unicode and Emacs interface

Previous Next

Package: guix;

Reported by: Alex Kost <alezost <at> gmail.com>

Date: Wed, 23 Sep 2015 10:52:02 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


Message #8 received at 21536 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Alex Kost <alezost <at> gmail.com>
Cc: 21536 <at> debbugs.gnu.org
Subject: Re: bug#21536: Texi, Unicode and Emacs interface
Date: Thu, 24 Sep 2015 00:02:16 +0200
[Message part 1 (text/plain, inline)]
Alex Kost <alezost <at> gmail.com> skribis:

> Evaluate there:
>
>   ((@@ (guix ui) texi->plain-text) "foo \u2015 bar.")
>
> So far so good.
>
> 2. Now connect to it, either with:
>
>    - netcat: "netcat localhost 37146"
>
>    - or Geiser: "M-x connect-to-guile"
>
> and evaluate the same expression.  This time you will get the error.

The encoding error comes from the fact that ‘texi->plain-text’ uses a
string port, and string ports internally use the current locale encoding
or ‘%default-port-encoding’.

Consequently, when running in the “C” locale, string ports cannot
represent non-ASCII code points (something widely regarded as a bug in
Guile, and at the very least an annoyance.)

To work around that, you can type this in *Guix Internal REPL*:

  (fluid-set! %default-port-encoding "UTF-8")

I fixed in commit 2cad18a8 of guix-artwork.git, but perhaps a similar
hack is apparently needed elsewhere.

Could you test this patch:

[Message part 2 (text/x-patch, inline)]
diff --git a/guix/ui.scm b/guix/ui.scm
index 4a3630f..67dd062 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."
[Message part 3 (text/plain, inline)]
> BTW, since we now use texi for the package descriptions, does it mean
> that our intention is to get rid of using unicode symbols directly?

Not particularly.

Thanks,
Ludo’.

This bug report was last modified 9 years and 241 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.