[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Denemo-devel] Problem with wide characters on upgrading to guile 2.
Re: [Denemo-devel] Problem with wide characters on upgrading to guile 2.x
Wed, 04 Sep 2013 17:37:56 +0100
On Wed, 2013-09-04 at 12:17 -0400, Mark H Weaver wrote:
> Richard Shann <address@hidden> writes:
> > On Tue, 2013-09-03 at 19:53 +0200, Thien-Thi Nguyen wrote:
> > [...]
> >> pt_BR.utf8 is not a supported locale on your system.
> > yes, that is why I chose it, so as to trigger the error. It is graceful
> > handling of this error that I was after - it should default to
> > untranslated, not abort the program.
> I disagree. If Guile does not know what encoding to use, that's a
> serious error that should not be ignored, at least not by default.
> Please keep in mind that Guile is used for many diverse tasks, including
> scripts that are run when the user's not looking, e.g. cron jobs. Guile
> must not silently corrupt data, which could easily happen if it silently
> ignores the error without knowing what character encoding to use.
Ah, I see.
> For fully interactive programs, ignoring the error and defaulting to the
> C locale (e.g. ASCII) is more reasonable, because any corruptions will
> hopefully be noticed by the user. To do that, please consider the code
> that Ludovic suggested:
> (catch 'system-error
> (lambda ()
> (setlocale LC_ALL ""))
> (lambda args
> (format (current-error-port)
> "warning: failed to install locale: ~a~%"
> (strerror (system-error-errno args))))
> However, it should be noted that if you do this, Guile 2 (unlike 1.8)
> will still raise an error later if you try to read a byte outside of the
> ASCII range, or if you try to write a non-ASCII character.
Hmm, this all started with guile barfing on utf8 characters in the
scripts it gets from the Denemo program. I'm afraid I've messed up the
title of the thread by a misused "Group Reply", but the setlocale is
being called from C to as a fix for that problem (barfing on utf8):
as suggested by Mike Gran. This works when I use the program with a
(utf8) locale that I have installed, that is scripts with embedded utf8
characters work again. But guile aborts with the erroneous locale set.
Perhaps this is not so important after all.
Re: Problem with wide characters on upgrading to guile 2.x, Andy Wingo, 2013/09/07