Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <C7GLQXB257CD.161VTRHQZOFWH@mussels>
Date: Mon, 30 Nov 2020 09:37:47 -0300
From: Érico Nogueira <ericonr@...root.org>
To: <musl@...ts.openwall.com>, "Dong Brett" <brett.browning.dong@...il.com>
Subject: Re: Question on C++ locale

On Mon Nov 30, 2020 at 8:35 AM -03, Szabolcs Nagy wrote:
> * Dong Brett <brett.browning.dong@...il.com> [2020-11-30 18:41:33
> +0800]:
> > However, the following C++ code does not work (our software uses std::locale in C++ standard library for locale related stuff):
> > #include <langinfo.h>
> > #include <locale.h>
> > #include <locale>
> > using namespace std;
> > int main()
> > {
> >     std::locale::global(locale(""));
> >     initscr();
> >     printw("LC_ALL: %s\n", setlocale(LC_ALL, NULL));
> >     printw("C++ locale: %s\n", locale().name().c_str());
> >     printw("CODESET: %s\n", nl_langinfo(CODESET));
> >     printw("Hello, world!\n");
> >     printw("你好,世界!\n");
> >     refresh();
> >     getch();
> >     endwin();
> >     return 0;
> > }
>
> fwiw for me even the first line fails.
> i don't know how c++ locales are supposed to work.
>
> $ cat a.cc
> #include <locale>
> using namespace std;
> int main()
> {
> std::locale::global(locale(""));
> return 0;
> }
>
> $ g++ a.cc
> $ ./a.out
> terminate called after throwing an instance of 'std::runtime_error'
> what(): locale::facet::_S_create_c_locale name not valid
> Aborted

For an example of this issue "in the wild", so to speak, I can only
launch supertux2 [1] with LANG=C. Exact same error message otherwise.

- [1] https://github.com/SuperTux/supertux

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.