Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #10776

Re: Setting C++ locale for 1 category

From Nobody <nobody@nowhere.com>
Subject Re: Setting C++ locale for 1 category
Date 2011-10-10 17:54 +0100
Message-Id <pan.2011.10.10.16.54.25.297000@nowhere.com>
Newsgroups comp.lang.c++
References <8d360081-f1ee-4324-a958-df3eb2981340@5g2000yqo.googlegroups.com>
Organization Zen Internet

Show all headers | View raw


On Mon, 10 Oct 2011 08:29:49 -0700, Stephen Howe wrote:

> How do I set the global locale but just for LC_CTYPE alone?

std::locale::global(std::locale(std::locale(), "C", std::locale::ctype));

This sets the C++ global locale, but I don't know if it's guaranteed to
set the C locale. It works with g++ on Linux, where std::locale().name()
returns a string of the form "LC_CTYPE=C;LC_NUMERIC=en_GB;...".

It's probably safe to assume that it won't work if you construct a locale
by mixing and matching facets rather than categories.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Setting C++ locale for 1 category Stephen Howe <stephen.howe@kantarmedia.com> - 2011-10-10 08:29 -0700
  Re: Setting C++ locale for 1 category Nobody <nobody@nowhere.com> - 2011-10-10 17:54 +0100
    Re: Setting C++ locale for 1 category Stephen Howe <stephen.howe@kantarmedia.com> - 2011-10-10 14:38 -0700
      Re: Setting C++ locale for 1 category Nobody <nobody@nowhere.com> - 2011-10-11 09:08 +0100

csiph-web