You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This new function differs from the already-existing plain
querylocale_i() in that it returns in the platform's native format,
instead of the internal=to-perl one.
The internal one is used generally so that code doesn't have to cope
with multiple possible formats. However, the format of the new locale
in Perl_setlocale() is going to be in native format. We effectively
translate it into our internal one at the input edge, and that is used
thereafter.
But until this commit, the translation back to native format at the
output edge was incomplete.
This mostly worked because native format differs from locale.c
internal format in just two ways:
One is the locale for LC_NUMERIC. perl keeps it generally in the C
locale, except for brief intervals which higher level code specifies,
when the real locale is swapped in. (Actually, this isn't quite true.
If the real locale is indistinguishable from C as far as LC_NUMERIC
goes, perl is happy to use it rather than C, so as to save swapping.)
locale.c had the code in it to translate the internal format back to
native, so it worked for this case.
The other is LC_ALL when not all categories are set to the same locale.
Windows and Linux use 'name=value;' pairs notation, while things derived
from BSD (and others) use a positional notation in which only the values
are given, and the system knows which category a given value is for from
its position in the string. Perl worked fine for the name=value pairs
notation, because that is the same as its internal one, so no
translation got done, but until this commit, there were issues on
positional platforms. This seldom got in the way since most people, if
they set the locale at all, will just set LC_ALL to some single 'foo'.
What this commit effectively does is change Perl_setlocale() to return
the value in the native format which the libc functions are expecting.
This differs from what it used to return only on platforms which use the
positional notation and only for LC_ALL when not all categories are set
to the same locale.
The new function subsumes much of the work previously done in
Perl_setlocale(), and it is able to simplify some of that work.
0 commit comments