GNU bug report logs -
#21536
Texi, Unicode and Emacs interface
Previous Next
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 #11 received at 21536 <at> debbugs.gnu.org (full text, mbox):
Ludovic Courtès (2015-09-24 01:02 +0300) wrote:
> 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.
Ah, I didn't follow 'guix-artwork' repo, now I see.
> Could you test this patch:
>
>
> 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."
Yes, I confirm that with this change the problem with Emacs interface is
solved, thank you!
--
Alex
This bug report was last modified 9 years and 240 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.