From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#21536: Texi, Unicode and Emacs interface Date: Thu, 24 Sep 2015 00:02:16 +0200 Message-ID: <87oagsg5g7.fsf@gnu.org> References: <87twqlflxj.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zes83-0004PK-O4 for bug-guix@gnu.org; Wed, 23 Sep 2015 18:03:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zes7y-0007l4-PG for bug-guix@gnu.org; Wed, 23 Sep 2015 18:03:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:50886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zes7y-0007kX-Mx for bug-guix@gnu.org; Wed, 23 Sep 2015 18:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zes7y-00030w-EJ for bug-guix@gnu.org; Wed, 23 Sep 2015 18:03:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87twqlflxj.fsf@gmail.com> (Alex Kost's message of "Wed, 23 Sep 2015 13:51:36 +0300") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Alex Kost Cc: 21536@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Alex Kost 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 =E2=80=98texi->plain-text=E2=80= =99 uses a string port, and string ports internally use the current locale encoding or =E2=80=98%default-port-encoding=E2=80=99. Consequently, when running in the =E2=80=9CC=E2=80=9D 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: --=-=-= Content-Type: text/x-patch Content-Disposition: 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 .) + (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." --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > 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=E2=80=99. --=-=-=--