Roger Leigh wrote:
> #include <locale.h>
> #include <stdio.h>
> #include <wchar.h>
>
> int
> main (void)
> {
> setlocale (LC_ALL, "");
> printf("‘Name1’\n");
> printf("%ls\n", L"‘Name2’");
> fwide(stderr, 1);
> fwprintf(stderr, L"‘Name3’\n");
> fwprintf(stderr, L"%s\n", "‘Name4’");
> printf("‘Name5’\n");
> return 0;
> }
>
> Try running this in a C locale!
>
> $ ./test
> 'Name3'
> ‘Name1’
> ‘Name5’
I get this (on a glibc 2.3 system):
$ LC_ALL=C ./test
‘Name1’
???Name3???
‘Name5’
Since the encoding of the C locale is ASCII, you can see that none of the
outputs is suitable for the C locale.
Conclusion: use gettext().
Bruno
--
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/linux-utf8/