Re: Guile integration and UTF-8
[email protected] (Ludovic Courtès)
| Newsgroups | gmane.comp.gnu.make.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, Lars Ljung <[email protected]> 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"). HTH, Ludo’. _______________________________________________ Make-alpha mailing list [email protected] https://lists.gnu.org/mailman/listinfo/make-alpha