unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] fix locale string reading
Date: Fri, 11 Nov 2011 18:39:24 -0500	[thread overview]
Message-ID: <87bosixm8j.fsf@netris.org> (raw)
In-Reply-To: <8762iqwh1n.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Fri, 11 Nov 2011 21:16:52 +0100")

ludo@gnu.org (Ludovic Courtès) writes:
> Nala Ginrut <nalaginrut@gmail.com> skribis:
>> +  setlocale (LC_ALL, "");
>
> Currently, like in C, it’s the programmer’s responsibility to install
> the locale with such a call, and none of Guile’s business.

Unfortunately, I don't see a way for the user to call setlocale before a
Guile script converts the command-line arguments to Scheme strings, at
least not without providing their own `main' function in C.

It wouldn't be too hard to postpone the conversion until the first time
(command-line) or (program-arguments) is called.  That would change the
semantics somewhat, e.g. if the program modifies the argv[] array before
the first call to (command-line), but it might still be a worthwhile
change.

However, what should we do about scripts that use `-e'?
For example:

     #!/usr/local/bin/guile \
     -e main -s
     !#

     (define (main args)
       (display args)
       (newline))

I think we should consider decoding the command-line arguments using the
locale specified by the environment variables, at least in cases like
this where there's no way for the user to call setlocale before the
conversion happens.

     Mark



  reply	other threads:[~2011-11-11 23:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 19:12 [PATCH] fix locale string reading Nala Ginrut
2011-11-08 13:31 ` Peter Brett
     [not found]   ` <CAPjoZoewXz+MMMD2N=8gp57AwsNG99UHc9KkhsizdK8U7djLvg@mail.gmail.com>
2011-11-09  2:59     ` Nala Ginrut
2011-11-09  3:11       ` Nala Ginrut
2011-11-09  4:10         ` Nala Ginrut
2011-11-09 10:20           ` Peter Brett
2011-11-09 10:46             ` Nala Ginrut
2011-11-09 13:45               ` Peter Brett
2011-11-10  0:36                 ` Nala Ginrut
2011-11-11 20:16 ` Ludovic Courtès
2011-11-11 23:39   ` Mark H Weaver [this message]
2011-11-14 22:42     ` Ludovic Courtès
2011-11-15  0:02       ` Mark H Weaver
2011-11-15 23:51         ` 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://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bosixm8j.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /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.
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).