unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Guy Ze Grant <gzg@riseup.net>
Cc: 15608@debbugs.gnu.org
Subject: bug#15608: kbd.scm unicode problem
Date: Wed, 16 Oct 2013 15:32:37 +0200	[thread overview]
Message-ID: <871u3lfiiy.fsf@gnu.org> (raw)
In-Reply-To: <8911b57e425d728f6dd5087409c29e22.squirrel@fruiteater.riseup.net> (Guy Ze Grant's message of "Mon, 14 Oct 2013 01:14:43 -0700")

"Guy Ze Grant" <gzg@riseup.net> skribis:

> I was asked to post here, so here it is; Attached is my expression thus
> far for kbd, at the patch phase though -- the following issue pops up:
> "find-files: ./doc/utf/??????: No such file or directory", along with a
> spew of guile barf following (which you can see in the kbd.scm.log file).

As we discussed on IRC, the problem is that POSIX considers file names
to be just byte strings, and the encoding is up to the application, and
locale-dependent by default.  In practice people typically use UTF-8
(GLib and friends expect that.)

Here’s the problem and fix:

--8<---------------cut here---------------start------------->8---
$ echo $LANG
en_US.UTF-8

$ ls -a
.  ..  ♪♬

$ guile -c '(use-modules (ice-9 ftw)) (pk (scandir "."))'

;;; (("." ".." "??????"))

$ guile -c '(use-modules (ice-9 ftw)) (setlocale LC_ALL "en_US.utf8") (pk (scandir "."))'

;;; (("." ".." "♪♬"))
--8<---------------cut here---------------end--------------->8---

In the first run Guile uses the “C” locale, so it’s unable to decode “♪♬”.

In the second run it uses a UTF-8 locale, so everything works fine.

Back to kbd: can you add a phase after the ‘unpack’ phase that just
does this?

  (setlocale "LC_ALL" "en_US.utf8")

If that works we can probably make it the default in the ‘core-updates’
branch.

> (define-module (gnu packages kbd)

Since kbd is Linux-specific, could you put it in (gnu packages linux)?

[...]

>  102: 1 [patch-source-shebangs # ...]
> In unknown file:
>    ?: 0 [sort # #<procedure string<? (#:optional _ _ . _)>]
>
> ERROR: In procedure sort:
> ERROR: In procedure list-copy: Wrong type argument in position 1: ("./config/ylwrap" "./config/install-sh" "./config/depcomp" "./config/config.sub" "./config/config.rpath" "./config/missing" "./config/config.guess" "./config/mkinstalldirs" "./config/compile" "./
[...]
> " "./doc/utf/README" "./doc/utf/ethiopic" . #f)

It’s also a bug that ‘find-files’ returns a improper list when
encountering such an issue.  I’ll fit it in ‘core-updates’.

Thanks,
Ludo’.

  reply	other threads:[~2013-10-16 13:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14  8:14 bug#15608: kbd.scm unicode problem Guy Ze Grant
2013-10-16 13:32 ` Ludovic Courtès [this message]
2013-12-10 21:59   ` Ludovic Courtès
2014-02-28 11:16     ` Ludovic Courtès
2014-06-17 12:20 ` 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=871u3lfiiy.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=15608@debbugs.gnu.org \
    --cc=gzg@riseup.net \
    /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).