unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Mike Gran <spk121@yahoo.com>
To: Andy Wingo <wingo@pobox.com>
Cc: bug-guile@gnu.org, linasvepstas@gmail.com,
	Guile Development <guile-devel@gnu.org>
Subject: Re: UTF-8 regression in guile 1.9.5
Date: Sun, 10 Jan 2010 14:00:31 -0800 (PST)	[thread overview]
Message-ID: <67395.2223.qm@web37901.mail.mud.yahoo.com> (raw)
In-Reply-To: <m3aawnrw2d.fsf@pobox.com>

> From: Andy Wingo <wingo@pobox.com>


> Hi,
> 
> Reviving an old thread...
> 

> > I think I prefer that the coder take the responsibility of calling
> > setlocale, but, I only think that because it is how C works.  I'm used
> > to that convention.
> 
> I would still prefer ponies and magic, but I realized: if we do a
> setlocale(LC_ALL, "") at the beginning, might that not change e.g. the
> floating point format, or some other locale-related variable, which
> would make Guile modules unreadable, or otherwise semantically different
> or invalid?
> 
> I'm asking because I ran into this bug now:
> 
>     scheme@(guile-user)> ,pr (resolve-module '(gnome gtk))
>     Throw to key `wrong-type-arg' with args `("procedure-name" "Wrong type 
> argument in position ~A: ~S" (1 #) 
> (#))'.
>     Entering the debugger. Type `bt' for a backtrace or `c' to continue.
>     0 debug> bt
>     In current input:
>     : 13 ERROR: cannot convert to output locale "NONE": 
> ""dynamic-wind""
> 
> So I guess we need a special case for NONE there, or something. I really
> don't understand i18n/l10n.

A LOCALE=NONE is the same as setting locale to any undefined value,e.g.
LOCALE=martian_mars.  There isn't a locale called 'none', so the system 
can provide no clues on how I/O, date format, etc, should be done.

All programs are supposed to start with locale="C", so I guess the
NONE locale is being set explicitly at some point.  On my box, I can't
(setlocale LC_ALL "NONE") since I don't have a NONE locale.

So, the fact that locale=NONE seems like a bug to me.

For Guile string conversion, if locale=NONE has some non-buggy meaning, 
I'd probably suggest making NONE the same as UTF-8.  We can do whatever
we want, since the result of the operation of conversion into NONE
is undefined.

But as far as the greater question of the side effects of setting locale
early on startup...  The parsing of any source code files after locale 
is set will be done in that context.  I don't think it would do anything
unexpected. The reader and the port routines tend to do their own parsing,
and don't tend to rely on libc locale-specific routines.  Even so, it 
would take some auditing to prove that there would be no effect.

If you were to set the locale in Guile, you would need to add
a condition to catch if the current LANG envvar isn't set to a valid
locale so you can fall back to the "C" locale.

-Mike Gran




  reply	other threads:[~2010-01-10 22:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-06 18:43 UTF-8 regression in guile 1.9.5 Linas Vepstas
2009-12-06 19:16 ` Mike Gran
2009-12-06 19:33   ` Linas Vepstas
2009-12-06 20:40     ` Mike Gran
2009-12-06 20:43       ` Linas Vepstas
2009-12-11 10:29         ` Andy Wingo
2009-12-11 15:05           ` Mike Gran
2009-12-11 15:40             ` Linas Vepstas
2009-12-11 22:50             ` Ludovic Courtès
2010-01-09 18:07             ` Andy Wingo
2010-01-10 22:00               ` Mike Gran [this message]
2010-01-11 13:38                 ` Ludovic Courtès
2010-01-11 21:18                   ` Andy Wingo
2010-01-12 11:25                     ` Ludovic Courtès
2010-01-12 19:36                       ` Andy Wingo
2010-01-12 22:26                         ` 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=67395.2223.qm@web37901.mail.mud.yahoo.com \
    --to=spk121@yahoo.com \
    --cc=bug-guile@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=linasvepstas@gmail.com \
    --cc=wingo@pobox.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.
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).