[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing the environment's locale encoding settings

From: Mark H Weaver
Subject: Re: Accessing the environment's locale encoding settings
Date: Fri, 18 Nov 2011 17:17:49 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

Noah Lavine <address@hidden> writes:
> It seems like the right thing to do might be to do setlocale(LC_ALL,
> "") in Guile's main(). Let me argue that this accomplishes two goals
> which we want to accomplish

I agree wholeheartedly; this should be the default behavior.  In the
rare cases where the user needs to avoid calling setlocale, they can
provide a different main().

Regarding backward compatibility: the current behavior already breaks
it.  For most practical purposes, Guile 1.8 effectively accepts
command-line arguments in the current locale encoding (although it is
certainly broken with regard to its handling of character indices within
such strings).  Guile 2.0 currently accepts only ASCII.

I don't see any sane way to preserve 100% backward compatibility with
the broken behavior of 1.8.  It seems to me that calling setlocale in
Guile's main() is not only the right thing moving forward, but also the
most backward-compatible option that is reasonably sane.

Peter Brett <address@hidden> writes:
> That seems entirely reasonable to me, as long as libguile users can
> still set a non-environment locale before first entering Guile mode and
> have libguile respect that.

Setlocale would only be called within main() of the Guile executable.
It would never be automatically called within libguile, so any program
that contains its own main() in C would be responsible for calling
setlocale (if it chooses to).

> However, I'd still be concerned about the case where filenames are
> passed on the command line in an encoding that differs from the
> environment encoding.  A few months ago, Mark mentioned that he was
> looking at "safe" encodings for filenames.  I wonder if that's relevant
> to command-line argument processing?

I apologize for dragging my feet on this for so long.  A few months ago
I argued forcefully for a particular approach to this thorny issue, and
then later had second thoughts.  It is important to get this right,
because we will have to live with our chosen approach for a long time.
I hope to write another email on this subject soon.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]