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 has never worked properly before in Perl. The code is returning
the result of the libc function nl_langinfo(). The documentation for it
that I have found (and presumably my predecessors) is very unclear. But
what actually happens (from using gdb) is that the return is very C
unfriendly.
Instead of returning a NUL-terminated string, it returns 100 (perhaps
fewer) NUL-terminated strings in a row. When it is fewer (given the
few examples I've seen), the final one ends with two NULs in a row. (I
can't think of a way for it to work and be otherwise). The 100th one
doesn't necessarily have two terminating NULs.
Prior to this commit, only the string for the zeroth digit was returned;
now the entire ALT_DIGIT string sequence is returned, forcing a double
NUL at the end of the final one.
This information is accessible in several ways. Via XS, one can use any
of several functions, including the newly introduced sv_langinfo(),
returning an SV, which allows for easier handling of embedded NULs.
(Otherwise in XS, using the functions that return a char*, one has to
look for the double-NUL.)
From Perl-space, the access is via I18N::Langinfo, which behind the
scenes also uses an SV. The documentation added in this commit gives
advice for how to turn the return into an @array for more convenient
access.
0 commit comments