Re: Odd encoding issue with UTF-8 + gettext yields ? on non-ASCII
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Aug 29, 2010, 18:12 UTC
- Message-ID
- <AANLkTimn+-5Vys+jg=ryDfwdJ=WZfGwgZ+065M_=TF8r@mail.gmail.com>
- In-Reply-To
- <20100828221655.GB5777@burratino>
On Sat, Aug 28, 2010 at 22:16, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 21 quoted lines
> $ /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 <stdio.h>
> #include <locale.h>
>
> 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: -1So, 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.