From: ludo@gnu.org (Ludovic Courtès)
To: Alex Kost <alezost@gmail.com>
Cc: 21536@debbugs.gnu.org
Subject: bug#21536: Texi, Unicode and Emacs interface
Date: Thu, 24 Sep 2015 00:02:16 +0200 [thread overview]
Message-ID: <87oagsg5g7.fsf@gnu.org> (raw)
In-Reply-To: <87twqlflxj.fsf@gmail.com> (Alex Kost's message of "Wed, 23 Sep 2015 13:51:36 +0300")
[-- Attachment #1: Type: text/plain, Size: 982 bytes --]
Alex Kost <alezost@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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 704 bytes --]
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."
[-- Attachment #3: Type: text/plain, Size: 188 bytes --]
> 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’.
next prev parent reply other threads:[~2015-09-23 22:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 10:51 bug#21536: Texi, Unicode and Emacs interface Alex Kost
2015-09-23 22:02 ` Ludovic Courtès [this message]
2015-09-24 12:02 ` Alex Kost
2015-09-24 20:16 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oagsg5g7.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=21536@debbugs.gnu.org \
--cc=alezost@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).