This is the mail archive of the
mailing list for the glibc project.
Re: Handling numbers input/output in glibc
- From: Bruno Haible <bruno at clisp dot org>
- To: libc-alpha at sources dot redhat dot com
- Cc: Behdad Esfahbod <behdad at cs dot toronto dot edu>, Hamed Malek <hamed at bamdad dot org>, Roozbeh Pournader <roozbeh at sharif dot edu>, Markus Kuhn <mgk25 at cl dot cam dot ac dot uk>, Keld Jørn Simonsen <keld at dkuug dot dk>
- Date: Mon, 2 Feb 2004 20:33:23 +0100
- Subject: Re: Handling numbers input/output in glibc
Behdad Esfahbod wrote on 2004-01-10:
> Problem statement: In Persian (fa_IR) locale, we like to read
> and write numbers with Persian numerals (U+06F0..U+06F9).
To this I'd like to add the important additional explanation that you
made on 2004-01-06:
> The border between which numbers should be written with local
> digits, which with latin digits, is not quite clear. For example
> in Persian we write every number with Persian digits, but I can
> see how we may write a price with US dollar currency sign with
> Latin digits. Or Arab people may have their own desires about
> which numbers they would like to see in their local digits, which
> not. So the decision better be left to each translation team,
The solution that is implemented for this is:
- The application developer uses gettext() around all format strings that
- gettext() looks up the translation in the Persian message catalog. It
may contains "%Id" instead of "%d".
- printf substitutes outdigits for those numbers that are output with "%Id".
This should be sufficient, isn't it?
> By now it should be clear that as it turns out from the
> definition, the "outdigit" digits should be used for output
> formatted by "%d". In other words, the "%Id" should become the
> default behaviour.
> Proposed changes/extensions to glibc:
> - Make "%Id" behaviour default. Same for "%If".
> - Deprecate "I" flag.
> - Having a flag "P" that outputs numbers in POSIX locale is
This is not appropriate, because
1. As you said above, it is not the desired behaviour in all cases.
2. Many programs will break when sprintf(buf,"%d",0) is not "0" any more.
Persian users would be those who would suffer. You won't succeed in
asking thousands of program authors to use "%Pd" instead of "%d".