Stephane Chazelas <> wrote, on 15 May 2018:
> OK, so to rephrase and make sure I understand correctly. In
> locales other than C, [[:digit:]] will be guaranteed to match on
> 0123456789 only but not [0-9]. 0123456789 are guaranteed to be
> in that order but [0-9] is unspecified anyway outside of the C
> locale.
> That's a bit counter-intuitive

Not really, when you consider that ranges should use the collation
sequence, not character encodings.  (For the C/POSIX locale that's
required - for others it's not, but it's the obvious way to implement
ranges with multibyte characters.)

In languages where there are alternative "digit" representations,
the locale definition might give the various representations of each
"digit" the same primary weight in the collating sequence, in which
case [0-9] would include some characters that are not true digits
(according to iswdigit()).

Geoff Clare <>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England

Reply via email to