This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] moneypunct<wchar_t>: mbsrtowcs or just btowc?
- From: Nathan Myers <ncm-nospam at cantrip dot org>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Sat, 10 Apr 2004 11:45:17 -0700
- Subject: Re: [RFC] moneypunct<wchar_t>: mbsrtowcs or just btowc?
- References: <4075CFB6.80000@suse.de> <4075D390.9000608@roguewave.com>
On Thu, Apr 08, 2004 at 04:34:56PM -0600, Martin Sebor wrote:
> Paolo Carlini wrote:
>
> >>If you want the library to work with locales created by the
> >>localedef utility you can't assume that. It's trivial to create
> >>locales with any arbitrary currency symbol, including one that
> >>contains multibyte character sequences. IMO, the small performance
> >>gain you get by making these kinds of assumptions is not worth the
> >>loss of robustness.
> >
> >Ok, I agree, thanks (and anyway we cache that info ;)
My point was that since the international string is governed by a
standard, and anything other than (perhaps) space, dot, or an upper
case letter would be undefined, and there's no point in complexifying
to accommodate anything else. If somebody supplies a multibyte-encoded
character, you're not doing them any favors by covering up that they
made a mistake; the resulting "international" string wouldn't be
understood by any downstream software.
> >What about the interpretation of the fourth char of int_currency_symbol
> >for the C++ purposes??? Should be considered part of the C++ symbol or
> >not? What RW does?
>
> We currently use the whole string, including the last character.
> It seems that it's a space in most locales but I've seen a different
> character, too (e.g., '.' in it_IT.* locales on HP-UX: "ITL."). I'm
> not sure what's the right thing to do. I guess I ought to read up on
> it. A good rule of thumb would be the output of strftime() with the
> same format/pattern as for time_put.
I remember, now, about the fourth character. You just use it, as is.
Nathan Myers
ncm-nospam@cantrip.org