From: Ævar Arnfjörð Bjarmason Date: Sun, 29 Aug 2010 18:12:05 GMT Subject: Re: Odd encoding issue with UTF-8 + gettext yields ? on non-ASCII Message-ID: In-Reply-To: <20100828221655.GB5777@burratino> On Sat, Aug 28, 2010 at 22:16, Jonathan Nieder wrote: > $ /lib/libc.so.6  |head -1 > GNU C Library (Debian EGLIBC 2.11.2-2) stable release version 2.11.2, by Roland McGrath et al. > $ cat test.c > #include > #include > > int main(void) > { >        int n; > >        setlocale(LC_CTYPE, ""); >        n = printf("%.11s\n", "Author: \277"); >        perror("printf"); >        fprintf(stderr, "return value: %d\n", n); >        return 0; > } > $ make test > cc     test.c   -o test > $ ./test > printf: Invalid or incomplete multibyte or wide character > return value: -1 So, my plan of attack is: * Add compat/printf from Free, Open or NetBSD. Maybe make compat/snprintf.c use that while I'm at it. * Use that instead of the GNU libc printf on systems that have glibc. * Add a configure check for that. * Revert 107880a * Get gettext goodness with LC_CTYPE Does anyone see a problem with that? The potential issue is that LC_CTYPE is for: "regular expression matching, character classification, conversion, case-sensitive comparison, and wide character functions." So it might have unintended side-effects. But the only other workaround I can see is to decree that all consumers of the localized messages must have a UTF-8 locale.