Replace FSF snail mail address with URLs.
[glibc.git] / intl / tst-gettext3.c
blobd661a490992970364d2b63d32bbe6414b4f884e1
1 /* Test that the gettext() results come out in the correct encoding for
2 locales that differ only in their encoding.
3 Copyright (C) 2001, 2005 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Bruno Haible <bruno@clisp.org>, 2001, 2005.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
21 #include <libintl.h>
22 #include <locale.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
27 int
28 main (void)
30 char *s;
31 int result = 0;
33 unsetenv ("LANGUAGE");
34 unsetenv ("OUTPUT_CHARSET");
35 textdomain ("codeset");
36 bindtextdomain ("codeset", OBJPFX "domaindir");
38 setlocale (LC_ALL, "de_DE.ISO-8859-1");
40 /* Here we expect output in ISO-8859-1. */
41 s = gettext ("cheese");
42 if (strcmp (s, "K\344se"))
44 printf ("call 1 returned: %s\n", s);
45 result = 1;
48 setlocale (LC_ALL, "de_DE.UTF-8");
50 /* Here we expect output in UTF-8. */
51 s = gettext ("cheese");
52 if (strcmp (s, "K\303\244se"))
54 printf ("call 2 returned: %s\n", s);
55 result = 1;
58 return result;