🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.internat
Article #720

Re: Support for i18n in C++

#720
From: James Kanze US/ESC 60/3/141 #407...
Date: Thu, 01 Feb 1996 17:30
62 lines
4212 bytes
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. ]
Technical Details
Message-ID: <KANZE.96Jan31165136@slsvewt.lts.sel.alcatel.de>
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
References: <1996Jan24.163403.3059@vmark.co.uk> <4ej4jp$87i@unet.net.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Newsgroups: comp.std.internat,comp.software.international,comp.lang.c++,comp.std.c++
Subject: Re: Support for i18n in C++
Date: 01 Feb 1996 09:30:01 PST
Organization: SEL
Approved: austern@isolde.mti.sgi.com
Message-ID: <KANZE.96Jan31165136@slsvewt.lts.sel.alcatel.de>
References: <1996Jan24.163403.3059@vmark.co.uk> <4ej4jp$87i@unet.net.com>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 31 Jan 1996 15:51:36 GMT
In-Reply-To: jyoti@viper.net.com's message of 29 Jan 1996 19:14:53 GMT
Apparently-To: std-c++@ncar.ucar.edu
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMRD44Uy4NqrwXLNJAQFQDwIAqJFkjTZ4XwwPOMFvgQjSfICX2LUqB3wN
 tpj7n7CfLi3aNY6Sgj6THxBo2n4MEskshExVN3ksekMSjKwiNhnhkg==
 =Bj3O
Originator: austern@isolde.mti.sgi.com