> No. Please provide a reproducible test case, that produces wrong
> results on an interesting platform. NetBSD 3.0 or IRIX 6.5, for
 > example, don't count.

Hello Mr Haible,

please find attached another test case (a shortened version of the
example in the gettext proposal that Eric Blake linked). It uses the
same mail.po and mail-utf8.po files that you provided earlier.
When I compile and run it on Ubuntu 20.04 (Ubuntu GLIBC
2.31-0ubuntu9.2), for both .po files it prints "Empf?nger" in ASCII
(converting the a-Umlaut into the question mark). This is probably
related to the transliteration mechanism you described.
I originally thought that the "?" was printed by my terminal and that
the output was printed without conversion, but when I investigated the
individual bytes with hexdump again, I noticed that actually an ASCII
question mark is printed.
However, the test case you sent earlier works on the same system as
documented, transliterating to "Empfaenger" correctly.
Because of this, I conclude that the different sequence in which the
gettext-functions are called causes this behavior which I would consider
a bug.

Kind regards,

Eric Ackermann,
student at HPI, University of Potsdam
/* Preparations:
- Install locale named 'de_DE.UTF-8' (using localedef).
- Find mail.po as provided by Bruno Haible
- $ mkdir -p de/LC_MESSAGES
  $ msgfmt -c -o de/LC_MESSAGES/mail.mo mail.po
  or
  $ msgfmt -c -o de/LC_MESSAGES/mail.mo mail-utf8.po
- $ gcc -Wall demo.c
- $ LANG="" LANGUAGE="" ./demo
*/
#include <libintl.h>
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
int main(void){
    unsigned long n_recipients;

    setlocale(LC_MESSAGES, "de_DE");
    bindtextdomain("mail", ".");
    textdomain("mail");
    bind_textdomain_codeset("mail", "ASCII");


    n_recipients = 1;

    printf("%s\n", ngettext("recipient", "recipients", n_recipients));

    // Outputs "1 Empf?nger" on up-to-date Ubuntu 20.04.
}
  • Question regarding ge... Eric Blake via austin-group-l at The Open Group
    • Re: Question reg... Bruno Haible via austin-group-l at The Open Group
      • Re: Question... Carlos O'Donell via austin-group-l at The Open Group
        • Re: Ques... Bruno Haible via austin-group-l at The Open Group
      • Re: Question... Eric Ackermann via austin-group-l at The Open Group
        • Re: Ques... Bruno Haible via austin-group-l at The Open Group

Reply via email to