unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: Bruno Haible <bruno@clisp.org>, guile-devel@gnu.org
Subject: Re: Accessing the environment's locale encoding settings
Date: Thu, 15 Dec 2011 20:08:31 +0100	[thread overview]
Message-ID: <87fwglejps.fsf@gnu.org> (raw)
In-Reply-To: <87d3ch6jdv.fsf@netris.org> (Mark H. Weaver's message of "Thu, 24 Nov 2011 21:11:40 -0500")

Hi,

Apologies for not answering earlier, and for making changes without
continuing this discussion.  So here’s an after-the-fact reply.

Mark H Weaver <mhw@netris.org> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>> It’s not completely satisfying either because --locale is not in
>> 2.0.[0-3], so users who really need it will need some configury;
>> furthermore, from 2.2.x on, it will be mostly unneeded.
>>
>> Yet, a choice has to be made between this hack and the other one.  :-)
>>
>> Thoughts?
>
> I like the --locale argument, except that the default (if there is no
> --locale argument) should be to either (A) call setlocale(LC_ALL, "") or
> (B) do something like the other hack, where the arguments are decoded as
> if the locale had been temporarily set according to the environment
> variables.
>
> My strong preference would be Option A.

The problem I see with changing the default to call setlocale(LC_ALL,
"") is that %default-port-encoding would no longer match the current
locale, as is currently the case.  Or we’d have to change its default
value.  But I thought this would be too disruptive in either case, and
thus I stick to Option B.

> If you are trying to maintain backward compatibility, keep in mind that
> for most practical purposes, Guile 1.8 acts closer to option A than the
> other options.  Furthermore, Option A is the Right Thing moving forward,
> and matches what Guile 2.2 will do.
>
> If we accept only ASCII arguments by default, then _most_ Guile scripts
> will need to add the --locale argument, but only for versions after
> 2.0.3.  More likely, many authors won't bother with this ugliness, and
> their scripts will be broken for non-ASCII locales.

Yes, I thought about that too, and thought it counted against Option A.

So the current situation is:

  • In 2.0, one still has to call ‘setlocale’ implicitly, but
    command-line arguments are converted from the locale encoding
    suggested by the environment variables (commit
    ed4c3739668b4b111b38555b8bc101cb74c87c1c).

  • In 2.1, the ‘setlocale’ call is implicit when the ‘guile’ executable
    is used (commit bb9b357e2b98cea82f844115ee5f66704bb6a1c8).  The
    %default-port-encoding value is still Latin-1, but presumably that
    would need to be changed to the current locale encoding.  Thoughts?

Nothing’s set in stone and I’m glad to revisit the situation.

Thanks,
Ludo’.



  reply	other threads:[~2011-12-15 19:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16  0:13 Accessing the environment's locale encoding settings Ludovic Courtès
2011-11-16  2:00 ` Bruno Haible
2011-11-16 10:35   ` Ludovic Courtès
2011-11-16 16:11     ` Noah Lavine
2011-11-16 16:32       ` Peter Brett
2011-11-18 22:17         ` Mark H Weaver
2011-11-20 16:55     ` Bruno Haible
2011-11-20 17:41       ` Ludovic Courtès
2011-11-20 19:44         ` Mike Gran
2011-11-23 23:28           ` Ludovic Courtès
2011-11-24  4:42             ` Mike Gran
2011-11-24 13:16             ` Peter Brett
2011-11-25  2:11             ` Mark H Weaver
2011-12-15 19:08               ` Ludovic Courtès [this message]
2011-11-20 20:12         ` Bruno Haible
2011-12-15  0:41           ` 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=87fwglejps.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=bruno@clisp.org \
    --cc=guile-devel@gnu.org \
    --cc=mhw@netris.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).