[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guile integration and UTF-8
From: |
Paul Smith |
Subject: |
Re: Guile integration and UTF-8 |
Date: |
Tue, 24 Sep 2013 22:31:29 -0400 |
On Tue, 2013-09-24 at 23:11 +0200, Ludovic Courtès wrote:
> Hi,
>
> Lars Ljung <address@hidden> skribis:
>
> > 2) This simple example fails because of the UTF-8 string:
> >
> > all:
> > @echo $(guile "Hej, världen!")
> >
> > The result is:
> >
> > ERROR: Unknown object: "Hej, världen!".
>
> Make uses ‘scm_c_eval_string’, which expects to be passed a string in
> the current locale encoding.
>
> So, if you have a UTF-8-encoded Makefile, but run ‘make’ with a
> ISO-8859-1 locale, the string will be incorrectly decoded.
>
> In particular, ‘to-string-maybe’ in gmk-default.scm will consider that
> some characters are not printable, leading to the “Unknown object” error.
>
> The fix would be to convert the string passed to $(guile ...) from a
> fixed encoding, rather than from the current locale encoding. For
> instance:
>
> scm_eval_string (scm_from_utf8_string (argv[0]))
>
> Better yet, use ‘scm_file_encoding’ to determine the encoding of a
> makefile based on the presence of -*- coding -*- cookies (info "(guile)
> Character Encoding of Source Files").
Thanks Ludo'. I figured it was something like that.
I haven't made a formal definition, but I'm seriously leaning towards
declaring that makefiles are UTF-8, always, and not supporting other
encodings. I'd like to discuss the possible downsides with others who
are more versed in i18n issues than I before I do this, and I won't do
it for this release, but I'm really expecting to do it (and document it
as such in the manual, etc.) shortly.
Re: Guile integration and UTF-8, Paul Smith, 2013/09/25