Reading localized digits in glibc

Hamed Malek hamed@bamdad.org
Wed Jun 30 11:34:00 GMT 2004


Hi All,

Few month ago I have sent a patch for implementing I18n flag for float
numbers and then localized decimal point and thousands-sep in GLibc
which able us to see localized numbers in our locale instead of ASCII
ones.

Now and after another patch by Bruno Haible in gettext, By replacing
every "%d" and "%f" modifiers with "%Id" and "%If" in po files, all our
needs for displaying localized digits are met.

Fortunately, for reading those numbers in GLibc, there are enough
implemented code which let us to see localized digits in scanf by just
adding few codes to our locale. You can see all works in both
stdio-common and localedata directories and also some test-cases that
are written by Ulrich Drepper about 4 years ago.

But the main problem here is that ISO C 99 says the "digit" class must
only contain the BASIC LATIN digits (sections 7.25.2.1.5 and 5.2.1).
This is the sole reason that forbids us to change our digit class in
locale file:
http://sources.redhat.com/ml/libc-alpha/2004-06/msg00181.html
http://sources.redhat.com/ml/libc-alpha/2004-01/msg00142.html

There is an alternative solution here that we have used for our decimal
point and thousands-sep in printf that defines a map in locale file and
call this map in GLibc files to replace with original decimal point and
thousands-sep. These kind of solutions is not perfect when there is a
better implemented way in our hands.

I would appreciate of you ideas. Is it possible to change that C
standard? or is there any better idea to use those implemented code
without breaking any standard?

Regards,
Hamed




More information about the Libc-locales mailing list