Topic: Support for i18n in C++


Author: david_goldsmith@taligent.com (David Goldsmith)
Date: 1996/02/01
Raw View
In article <4ej4jp$87i@unet.net.com>, jyoti@viper.net.com wrote:
>Anyone know what sort of internationalization (i18n) support is available
>for C++? All i18n books talk about printf/scanf and such but none about
>cin/cout.
>
>If any one has any information, I'd appreciate it. If people beleive there
>isn't one, can you atleast email/post your doubts so I know that the request
>is being read and that it's just one of those things no one can help me with.

The public review draft of the C++ standard has a whole chapter devoted to
a localization library. The entire standard is online at:

http://www.cygnus.com/misc/wp/index.html

among other places (you can find more sites using Yahoo or other indices).

See chapters 21 and 22.

Of course, you may have a hard time finding an implementation of these
parts of the library right now.

--
David Goldsmith
Senior Scientist
Taligent, Inc.
10355 N. DeAnza Blvd.
Cupertino, CA  95014-2233
david_goldsmith@taligent.com
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]





Author: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Date: 1996/02/01
Raw View
In article <4ej4jp$87i@unet.net.com> jyoti@viper.net.com (Jyoti Patel,
NMS Engineering) writes:

|> I had inquired about this in the internationalization newsgroups but had no
|> response so I am trying again (with C++ newsgroups as well).

|> Anyone know what sort of internationalization (i18n) support is available
|> for C++? All i18n books talk about printf/scanf and such but none about
|> cin/cout.

|> If any one has any information, I'd appreciate it. If people beleive there
|> isn't one, can you atleast email/post your doubts so I know that the request
|> is being read and that it's just one of those things no one can help me with.

What sort of information do you want to know?  The standard goes
considerably farther than the C standard with regards to i18n.  In
particular:

1. All of the C routines (setlocale, etc.) are present.

2. There is even a specific class for locale.  This class is so
designed that an implementation may add additional locale dependancies
in a conforming manner.  (Using such additions, however, makes your
program unportable.)

3. Both the iostreams classes and string are templates on the
character type.  This means that there is full support for wchar_t
data, including all of the conversion functions.  The locale class is
also a template on the character type, so even things like isalpha are
defined for wchar_t.  The iostreams classes also have an imbue
function, to imbue the stream locally with a locale; I presume,
although I've not studied the question in detail yet, that this means
that you can even change the locale on the fly, for a specific stream.
(For example, I'm working in a French locale, with the comma as the
decimal point.  When reading a file, parsing some header information
tells me that it came from Great Britain.  So I imbue that stream with
the GB locale, and it will convert using the period as a decimal
point, without any other streams or functions being affected.)

What C++ doesn't support (as yet) is positional parameters, along the
lines of the X/Open extension to printf.  (Although this is not part
of the C standard, it is available on C compilers under Unix, and
maybe elsewhere.)

At present, most of this is new, and not available in the
implementations I have.  The intention, as I understand it, is that
wchar_t should become the basic character type for text.  On the other
hand, most existing text files do not use Unicode; on my system, all
of my text files are in ISO 8859-1.  When the vendors actually start
implementing what is in the standard, I will be interested in seeing
how they handle this problem.  Ideally, I will use a wchar_t form of
the iostreams, somehow impart on the stream what the actual external
code set is, and the stream will take care of the rest.
--
James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, itudes et rialisations en logiciel orienti objet --
                -- A la recherche d'une activiti dans une region francophone
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]





Author: Nathan Myers <ncm@cantrip.org>
Date: 1996/02/01
Raw View
Jyoti Patel <jyoti@net.com> NMS Engineering wrote:
> I had inquired about this in the internationalization newsgroups but had no
> response so I am trying again (with C++ newsgroups as well).
>
> Anyone know what sort of internationalization (i18n) support is available
> for C++? All i18n books talk about printf/scanf and such but none about
> cin/cout.
>
> If any one has any information, I'd appreciate it. If people beleive there
> isn't one, can you atleast email/post your doubts so I know that the request
> is being read and that it's just one of those things no one can help me
> with.

The Draft C++ Standard is quite well-equipped with internationalization
support.  Consult Clauses 22 and 27 of the latest draft working paper

  <http://www.cygnus.com/misc/wp/sep95/>.

[By the way: the sep95 draft is not for quoting -- it is just a working
 copy subject to sometimes radical change, not a standard.]

It is not yet described in books because it is too new, and not yet
implemented in publicly available products.

Nathan Myers
ncm@cantrip.org
http://www.best.com/~ncm/  (soon: http://www.cantrip.org/)
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]