This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: output unicode
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: fsshl at att dot net
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 27 Jun 2011 17:03:57 +0100
- Subject: Re: output unicode
- References: <1309189160.7372.10.camel@eric-laptop>
On 27 June 2011 16:39, eric <fsshl@att.net> wrote:
> Dear advanced c/g++ programers:
> ?after I copied and compiled last email's code
> ?I tested it, with your suggestion (put POSIX and C behind it), they
> run (generate locale),
> but
> all test failed to make output file with size > 0
> so if you can plz help again, and thank a lot in advance, Eric
>
> ------------------------------------------------------------
> eric@eric-laptop:~/cppcookbook$ ./a.out
> trying to access locale el_GR.utf8
> Couldn't generate locale el_GR.utf8: locale::facet::_S_create_c_locale
> name not valid
> Error when writing to file
As shown by 'locale -a' you don't have the el_GR.utf8 locale
installed, so obviously this won't work.
> eric@eric-laptop:~/cppcookbook$ ls -l -a unicode.txt
> -rw-r--r-- 1 eric eric 0 2011-06-27 08:31 unicode.txt
> eric@eric-laptop:~/cppcookbook$ ./a.out POSIX
> trying to access locale POSIX
> Generated locale C
> Error when writing to file
> eric@eric-laptop:~/cppcookbook$ ./a.out C
> trying to access locale C
> Generated locale C
> Error when writing to file
> eric@eric-laptop:~/cppcookbook$ ./a.out B
> trying to access locale B
> Couldn't generate locale B: locale::facet::_S_create_c_locale name not
> valid
> Error when writing to file
> eric@eric-laptop:~/cppcookbook$
> -------------------------------------------------------
Did you ever answer the question of which OS you're using?
Your gcc is using --enable-clocale=generic so doesn't support named
locales in the C++ library.
You could try running your code with a different global locale, i.e.
LANG=en_US.utf8 ./a.out