This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: output unicode
On Mon, 2011-06-27 at 17:03 +0100, Jonathan Wakely wrote:
> 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
----------------------------------------------------------------
thanks your suggestion,
here is the result of my test on your suggestion and what kind of I use
----
eric@eric-laptop:~/cppcookbook$ LANG=en_US.utf8 ./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
eric@eric-laptop:~/cppcookbook$ uname -r
2.6.35-25-generic
eric@eric-laptop:~/cppcookbook$
(Ubuntu/linux 10.04 upgrade kernel to 2.6.35-25)
I also modify from el_GR to en_US in en_US.utf8
then ./a.out (or LANG=en_US.utf8 ./a.out , same error)
trying to access locale en_US.utf8
Couldn't generate locale en_US.utf8: locale::facet::_S_create_c_locale
name not valid
Error when writing to file
looking to see more suggestion, Eric(g++4.5.2)
---------