]>
Commit | Line | Data |
---|---|---|
4e82c610 UD |
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. | |
6 | ||
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. | |
11 | ||
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. | |
16 | ||
17 | You should have received a copy of the GNU Lesser General Public | |
18 | License along with the GNU C Library; if not, write to the Free | |
19 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
20 | 02111-1307 USA. */ | |
21 | ||
22 | #include <libintl.h> | |
23 | #include <locale.h> | |
24 | #include <stdio.h> | |
25 | #include <stdlib.h> | |
26 | #include <string.h> | |
27 | ||
28 | int | |
29 | main (void) | |
30 | { | |
31 | char *s; | |
32 | int result = 0; | |
33 | ||
34 | unsetenv ("LANGUAGE"); | |
35 | unsetenv ("OUTPUT_CHARSET"); | |
36 | textdomain ("codeset"); | |
37 | bindtextdomain ("codeset", OBJPFX "domaindir"); | |
38 | ||
39 | setlocale (LC_ALL, "de_DE.ISO-8859-1"); | |
40 | ||
41 | /* Here we expect output in ISO-8859-1. */ | |
42 | s = gettext ("cheese"); | |
43 | if (strcmp (s, "K\344se")) | |
44 | { | |
45 | printf ("call 1 returned: %s\n", s); | |
46 | result = 1; | |
47 | } | |
48 | ||
49 | setlocale (LC_ALL, "de_DE.UTF-8"); | |
50 | ||
51 | /* Here we expect output in UTF-8. */ | |
52 | s = gettext ("cheese"); | |
53 | if (strcmp (s, "K\303\244se")) | |
54 | { | |
55 | printf ("call 2 returned: %s\n", s); | |
56 | result = 1; | |
57 | } | |
58 | ||
59 | return result; | |
60 | } |