Branch: refs/heads/smoke-me/khw-locale4
  Home:   https://github.com/Perl/perl5
  Commit: 172ddd8633bc97b323d9f4ef97a9c75ae934e478
      
https://github.com/Perl/perl5/commit/172ddd8633bc97b323d9f4ef97a9c75ae934e478
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  loc_tools: Create function, refactor

category_excluded() is a better name for what the current name
'is_category_valid" does.  And it turns out that we need to use this
function on (those few) systems that don't have LC_CTYPE to avoid
executing code that depends on LC_CTYPE.

And we do need an improved is_category_valid() for other checks.


  Commit: 8520732a11a168408a117c58431040d05c783d88
      
https://github.com/Perl/perl5/commit/8520732a11a168408a117c58431040d05c783d88
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  loc_tools.pl: Move code in file

This is for future commits to call after it is defined


  Commit: 86f1868070d2d9ee3e9f820487625f68d9d0f99e
      
https://github.com/Perl/perl5/commit/86f1868070d2d9ee3e9f820487625f68d9d0f99e
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  t/loc_tools.pl: Print better failing test numbers

This test module is 'required' from other perl test files.  If it
encounters an error, it doesn't know how to report it.  What it does is
call fail() if available, and a home-grown one otherwise.  Prior to this
commit the home-grown version just made all tests number 0.  This commit
changes that to make them sequentially numbered from a very high
starting one, so as not to interfere with the outer calls.


  Commit: ac60e808d2d7a624fbd45eb3231a83f7534d8f84
      
https://github.com/Perl/perl5/commit/ac60e808d2d7a624fbd45eb3231a83f7534d8f84
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  t/loc_tools.pl: Refactor _trylocale()

This function is used to see if a locale actually works on the current
platform.  I was not fully aware of the glitches if a category is in one
locale, and LC_CTYPE is in another.  This makes sure they are both the
same; and this results in some simplification.


  Commit: 32933b9b4e323d5fc9b89cb43e5f38a6c54e195b
      
https://github.com/Perl/perl5/commit/32933b9b4e323d5fc9b89cb43e5f38a6c54e195b
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  t/loc_tools.pl: Fail earlier

Move the code that returns failure into the loop, so won't keep
iterating if failure is going to happen anyway.


  Commit: aa44ebbda3133565d557e2b5b31a80ac669e01b4
      
https://github.com/Perl/perl5/commit/aa44ebbda3133565d557e2b5b31a80ac669e01b4
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  t/loc_tools.pl: Add checks

This verifies that we can restore a locale that we were previously in,
and makes sure that we don't stay in a locale that doesn't work well.
Doing so has led to crashes.


  Commit: 5bb6d44dd4f2b73329f1d4be5c022da9b10b42e8
      
https://github.com/Perl/perl5/commit/5bb6d44dd4f2b73329f1d4be5c022da9b10b42e8
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  t/loc_tools.pl: Don't allow commas in locale names

This was a problem in some buggy Windows versions.  This addition keeps
locales with this bug from being tested.


  Commit: e9c380290f6fdf942e7394c8f3c9c3e743b2f318
      
https://github.com/Perl/perl5/commit/e9c380290f6fdf942e7394c8f3c9c3e743b2f318
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  t/loc_tools.pl: Check for unsupported locales

This commit causes us not to view unsupported locales as legitimate for
testing.  Core dumps occurred on some platforms without this.

It looks for a diagnostic that the next commit in this series will
generate.


  Commit: e9d85bb3d17f8db772993bcb1347cd71ea7374dd
      
https://github.com/Perl/perl5/commit/e9d85bb3d17f8db772993bcb1347cd71ea7374dd
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  t/loc_tools.pl: White-space only


  Commit: 7164d0d900d39f6c7eaa6dafc7f90a3bff514073
      
https://github.com/Perl/perl5/commit/7164d0d900d39f6c7eaa6dafc7f90a3bff514073
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/loc_tools.pl

  Log Message:
  -----------
  t/loc_tools.pl: Turn off warnings in a timely manner

It doesn't matter much, but some warnings might be output by doing the
'use locale' before turning off warnings.


  Commit: 184dd41cd2d410383d61d9042dac017ea7028140
      
https://github.com/Perl/perl5/commit/184dd41cd2d410383d61d9042dac017ea7028140
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M perl.c

  Log Message:
  -----------
  XXX msg: perl.c: Rm redundant initialization of PL_C_locale_obj

This


  Commit: 31380396765bc72663bc122475de9cdc5e20e48c
      
https://github.com/Perl/perl5/commit/31380396765bc72663bc122475de9cdc5e20e48c
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: querylocale return mortalized copy

It is too easy to forget to savepv() the return of these macros, leading
to hard-to-diagnose bugs.  Head those off at the pass by always making a
copy that gets freed by the system.


  Commit: fc0d2b32fedc0380901f2ccc502b98db156ced6a
      
https://github.com/Perl/perl5/commit/fc0d2b32fedc0380901f2ccc502b98db156ced6a
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Refactor a strerror implementation

The previous commit made it clear to me that this implementation of
strerror() could be simplified.  (There are several implementations
depending on what libc functions are available on the platform.)


  Commit: e61610bd6a16517d87f08385057445dac8091e6b
      
https://github.com/Perl/perl5/commit/e61610bd6a16517d87f08385057445dac8091e6b
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  Initialize PL_numeric_name, PL_collation_name

Having these initialized to the C locale aoids some otherwise required
conditionals.


  Commit: 53bb3284c81dcf23318616d41c1bf8c5e42f6aaf
      
https://github.com/Perl/perl5/commit/53bb3284c81dcf23318616d41c1bf8c5e42f6aaf
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Silence some compiler warnings if no LC_ALL


  Commit: 1c0f8c68f1934fc55f725644319b3560326b2658
      
https://github.com/Perl/perl5/commit/1c0f8c68f1934fc55f725644319b3560326b2658
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Don't change locale if already there

Changing the locale is cheap for some categories, but expensive for
others.  Changing LC_COLLATE is most expensive, requiring recalculation
of the collation transformation mapping.

This commit checks that we aren't already in the desired locale before
changing locales. and does nothing if no change is needed.


  Commit: 4b5a6507e2d3ca3fc65140b6c10a644c4b1d72d4
      
https://github.com/Perl/perl5/commit/4b5a6507e2d3ca3fc65140b6c10a644c4b1d72d4
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Separate out two Win fcns from a larger one

This makes the larger one easier to understand, and prepares for
possible independent calls to the two, which are potentially useful on
their own.


  Commit: 57a60d1a83e35cf5e9f4ca6c2a9c1b1212c7d2aa
      
https://github.com/Perl/perl5/commit/57a60d1a83e35cf5e9f4ca6c2a9c1b1212c7d2aa
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M ext/POSIX/POSIX.xs
    M locale.c
    M proto.h

  Log Message:
  -----------
  Move code for mbr?towc() from POSIX.xs to locale.c

This avoids duplicated logic.


  Commit: 930fe3890c285feef05b33e5094937c73acc176f
      
https://github.com/Perl/perl5/commit/930fe3890c285feef05b33e5094937c73acc176f
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Mollify clang

It claims this could be used uninitialized.  I don't think it can.


  Commit: d153d31cf74cc2839eee14c819f511fc3a9d610f
      
https://github.com/Perl/perl5/commit/d153d31cf74cc2839eee14c819f511fc3a9d610f
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Reorder cases in a switch

This moves handling the CODESET to the end, as future commits will make
its handling more complicated.  The cases are now ordered so the
simplest (based on the direction of future commits) are first


  Commit: a46864f67e418f8b3e4e3071444c0a6269d9d059
      
https://github.com/Perl/perl5/commit/a46864f67e418f8b3e4e3071444c0a6269d9d059
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Make statics of repeated string constants

These strings are (or soon will be) used in multiple places; so have
just one definition for them.


  Commit: b1f9a87a0e9236512c3636273fa4fca5c40032ab
      
https://github.com/Perl/perl5/commit/b1f9a87a0e9236512c3636273fa4fca5c40032ab
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add two #defines

This makes sure that we handle having any variant of nl_langinfo() or
localeconv().


  Commit: 0c018514b428a7eb0cdf5a23a61465007e8f4ad0
      
https://github.com/Perl/perl5/commit/0c018514b428a7eb0cdf5a23a61465007e8f4ad0
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Return defaults for uncomputable langinfo items

Return the values from the C locale for nl_langinfo() items that aren't
computable on this platform.  If the platform has nl_langinfo(), then
all of them are computable, but if not, some can't be computed, and
others can be, but only if there are alternative methods available on
the platform.

As part of this commit, S_my_nl_langinfo() and S_save_to_buffer() are no
longer used when USE_LOCALE is not defined, so don't compile them.


  Commit: de5f39a639e3ee8979faa464c5f9fab1d01dd460
      
https://github.com/Perl/perl5/commit/de5f39a639e3ee8979faa464c5f9fab1d01dd460
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Rmv reimplementation of my_strftime()

Prior to this commit, there was a near duplicate copy of the code from
util.c that implements my_strftime().  This was done because the util.c
version zaps the wday field, which made it incompatible.

But it dawned on me that if the arbitrary date we use to do our
calculations were such that it was for a year in which the wday field
gets zapped to the value we want it to be, then the util.c version
automatically works.  This happens in years when January 1 falls on a
Sunday.


  Commit: bbfe9374e35204caa8834f1e557630e8768aeca4
      
https://github.com/Perl/perl5/commit/bbfe9374e35204caa8834f1e557630e8768aeca4
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: White-space only

Align with previous commit and properly indent some preprocessor
directives


  Commit: feafa3feac96a8938113e0e843646fbbe1864bc4
      
https://github.com/Perl/perl5/commit/feafa3feac96a8938113e0e843646fbbe1864bc4
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Shorten static function name

The extra syllable(s) are unnecessary noise


  Commit: 5b53115191f8e9beeeb918dcf5d5c080b5ba8262
      
https://github.com/Perl/perl5/commit/5b53115191f8e9beeeb918dcf5d5c080b5ba8262
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Extend a static function

This will allow it to be used in situations where the buffer it controls
is single use, and we don't need to keep track of the size for future
calls.


  Commit: bd17b2af9a3802f670a86cd73cb6a25d9f84f418
      
https://github.com/Perl/perl5/commit/bd17b2af9a3802f670a86cd73cb6a25d9f84f418
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use typedef to simplify

This allows some preprocessor conditionals to be removed


  Commit: f53d252d264303ca1ab9c3680f9d03678df37b80
      
https://github.com/Perl/perl5/commit/f53d252d264303ca1ab9c3680f9d03678df37b80
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Rmv redundant cBOOL()

strEQ and && already return booleans


  Commit: 2535df11a0318dbacc940dd7c8b0284f341299cb
      
https://github.com/Perl/perl5/commit/2535df11a0318dbacc940dd7c8b0284f341299cb
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Fix currency symbol derivation

On platforms without nl_langinfo(), we derive the currency symbol from
localeconv().  The symbol must be tweaked to conform to nl_langinfo()
standards.  Prior to this commit, it guessed at how to tweak a rare
circumstance.  I found evidence this guess was wrong, so looked around,
and copied the way cygwin does it.

This also no longer returns just an empty string in certain cases.
nl_langinfo() itself doesn't, so conform to that.


  Commit: b85dbc4bdbbfa777faa6a0846d8366a49c0d6e73
      
https://github.com/Perl/perl5/commit/b85dbc4bdbbfa777faa6a0846d8366a49c0d6e73
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Don't add CP to Windows code page names

The actual name appears to be just the number for purposes of
nl_langinfo()-ish things.


  Commit: 7d852303710051c065efc7ba8ef6db9f7fb9694f
      
https://github.com/Perl/perl5/commit/7d852303710051c065efc7ba8ef6db9f7fb9694f
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Don't ask a static fcn to be inlined

It's too complicated to really be inlined, and the compiler can figure
things out itself given it is a static function


  Commit: a05f2a5f6073d86ca7f7f60a1ca61a076e98b365
      
https://github.com/Perl/perl5/commit/a05f2a5f6073d86ca7f7f60a1ca61a076e98b365
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M proto.h

  Log Message:
  -----------
  S_save_to_buffer() allow ignoring return value

Future commits will want to use this, while discarding the return value.


  Commit: 3c9d5729a45743dc88ed3d54df8c0bc74c4e9517
      
https://github.com/Perl/perl5/commit/3c9d5729a45743dc88ed3d54df8c0bc74c4e9517
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Rmv no longer used param from static fnc

Previous commits have gotten rid of this parameter to S_save_to_buffer


  Commit: 815165982236b8d47b67c77b38789a9e605cb8dd
      
https://github.com/Perl/perl5/commit/815165982236b8d47b67c77b38789a9e605cb8dd
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Don't read off buffer end

In some configurations, under the exact set of input it would have been
possible to read past the buffer end.  This commit adds a conditional to
prevent that.


  Commit: 0ff763b3a2111afe9245cca09757f416c611cf96
      
https://github.com/Perl/perl5/commit/0ff763b3a2111afe9245cca09757f416c611cf96
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Fix Windows bug with broken localeconv()

localeconv() was broken on Windows until VS 2015.  As a workaround, this
was using my_snprintf() to find what the decimal point character is,
trying to avoid our workaround for localeconv(), which has a (slight)
chance of a race condition.

The problem is that my_snprintf() might not end up calling snprintf at
all; I didn't trace all possibilities in Windows.  So it doesn't make
for a reliable sentinel.

This commit now specifically uses libc snprintf(), and if it fails, drops
down to try localeconv().

It also changes things so that if localeconv() is not present at all or
usable on the platform, to use this snprintf method.


  Commit: 4956d0d039043cc17c5fc1869705377b7ed1e5bd
      
https://github.com/Perl/perl5/commit/4956d0d039043cc17c5fc1869705377b7ed1e5bd
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Use a scratch buf; instead of reusing old

This is in preparation for the next commit


  Commit: f56bb96e9b02c985a52afca7dea289ff58ae8457
      
https://github.com/Perl/perl5/commit/f56bb96e9b02c985a52afca7dea289ff58ae8457
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M intrpvar.h
    M locale.c

  Log Message:
  -----------
  locale: make PL_langinfo_buf const *

The previous commit allows this change to be made.


  Commit: 195235d77b73871140057be63bea2af5c847a487
      
https://github.com/Perl/perl5/commit/195235d77b73871140057be63bea2af5c847a487
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M proto.h

  Log Message:
  -----------
  embed.fnc: Also check for NL_LANGINFO_L

The preprocessor directives were only flooking for plain nl_langinfo().
It's quite unlikely that a platform will have the '_l' version without
also having the plain one.  But this makes sure.


  Commit: e0ae7f48af9e7dcbb864a22eece94e759f0a9f67
      
https://github.com/Perl/perl5/commit/e0ae7f48af9e7dcbb864a22eece94e759f0a9f67
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Make static fcn reentrant

This makes my_langinfo() reentrant by adding parameters specifying where
to store the result.

This prepares for future commits, and fixes some minor bugs for XS
writers, in that the claim was that the buffer in calling
Perl_langinfo() was safe from getting zapped until the next call to it
in the same thread.  It turns out there were cases where, because of
internal calls, the buffer did get zapped.


  Commit: 8437a5c08a8324331eef969a6ec993cac46d2f1d
      
https://github.com/Perl/perl5/commit/8437a5c08a8324331eef969a6ec993cac46d2f1d
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: langinfo: Use Windows fcn to find CODESET

There is a Windows function, available for quite a long time, that will
return the current code page.  Use this for the nl_langinfo() CODESET,
as that libc function isn't implemented on Windows.


  Commit: d66fd3f77e418ca25670fcfc10f61676f57087da
      
https://github.com/Perl/perl5/commit/d66fd3f77e418ca25670fcfc10f61676f57087da
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Add static fcn to analyze locale name codeset

It determines if the name indicates it is UTF-8 or not.  There are
several variant spellings in use, and this hides that from the the
callers.

It won't be actually used until the next commit


  Commit: 4373dc51bae54e562029c2432302dabd6ae5c3bd
      
https://github.com/Perl/perl5/commit/4373dc51bae54e562029c2432302dabd6ae5c3bd
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M ext/I18N-Langinfo/Langinfo.pm
    M locale.c

  Log Message:
  -----------
  locale.c: Improve non-nl_langinfo() CODESET calc

Prior to this commit, on non-Windows platforms that don't have a
nl_langinfo() libc function, the code completely punted computation of
the CODESET item.  I have not been able to figure out how to do this,
even going to the locale definition files on disk (which may vary
anyway), but we can do a lot better than punting.

This commit adds three checks:

1) If the locale name is C or POSIX, we know the codeset

2) We can detect if a locale is UTF-8.  If it is, that is the codeset.
Many modern locales are of this ilk.

3) Failing that, some locales have the codeset appear in the name,
following a dot.

It isn't perfect, but it's a lot better than completely punting.


  Commit: 46682b3ceb5e6c580b5e808b103cb9574fe87a9f
      
https://github.com/Perl/perl5/commit/46682b3ceb5e6c580b5e808b103cb9574fe87a9f
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M locale.c
    M proto.h

  Log Message:
  -----------
  Add toggle_locale() fcns

These are designed to temporarily switch the locale for a cateogry
around some operation that needs it to be different than the current
one.  They will be used in the next commit.

These will eventually replace the more unwieldy
_is_cur_LC_category_utf8() function, which toggles as a side effect


  Commit: 9b32713473c184568d7c67849a40eb31787d87c7
      
https://github.com/Perl/perl5/commit/9b32713473c184568d7c67849a40eb31787d87c7
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  New signature for static fcn my_langinfo()

This commit changes the calling sequence for my_langinfo to add the
desired locale, and the locale category of the desired item.

This allows the function to be able to return the desired value for any
locale, avoiding some locale changes that would happen until this
commit, and hiding the need for locale changes from outside functions,
though a couple continue to do so to avoid potential multiple changes.


  Commit: 61ed1912567cc19b337f6b361e79a28f575858ba
      
https://github.com/Perl/perl5/commit/61ed1912567cc19b337f6b361e79a28f575858ba
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.: Need CTYPE to match other category for nl_langinfo

nl_langinfo knows about various components of locales that are supposed
to be defined for every locale, such as a string for a Yes/No response
or the name of a month in a particular language.  These are associated
with various locale categories.  In the examples cited, the month names
are in the LC_TIME category, and the responses in the LC_MESSAGES one.
But (perhaps because these are text strings), some platforms require the
LC_CTYPE locale to be the same as the other locale.  cygwin is an
example.  Rather than try to figure out which platform require this, and
which do not, it is a simple matter to just LC_CTYPE at the same time as
the other category


  Commit: 1cae6a06244a9b3463162c605a755561b1a65c4d
      
https://github.com/Perl/perl5/commit/1cae6a06244a9b3463162c605a755561b1a65c4d
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Add is_locale_utf8()

Previous commits have added the infrastructure to be able to determine
if a locale is UTF-8.  This will prove useful, and this commit adds
a function to encapsulate this information, and uses it in a couple of
places, with more to come in future commits.

This uses as a final fallback, mbtowc(), supposed to be available in
C99.  Future commits will add heuristics when that function isn't
available or is known to be unreliable on a particular system.


  Commit: 5bf4d785b41762da6182d1cfc713368c8c451e26
      
https://github.com/Perl/perl5/commit/5bf4d785b41762da6182d1cfc713368c8c451e26
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M perl.h
    M utf8.h

  Log Message:
  -----------
  utf8ness


  Commit: 5be59ef2617f6dbfd0e727c26a0c2b2a6c97edfe
      
https://github.com/Perl/perl5/commit/5be59ef2617f6dbfd0e727c26a0c2b2a6c97edfe
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Add fcn for UTF8ness determination

get_locale_string_utf8ness_i() will determine if the string it is passed
in the locale it is passed is to be treated as UTF-8, or not.


  Commit: 43c187998d48cf01131dac145fd49b10ede12d12
      
https://github.com/Perl/perl5/commit/43c187998d48cf01131dac145fd49b10ede12d12
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M ext/POSIX/POSIX.xs
    M locale.c
    M proto.h

  Log Message:
  -----------
  XXX perldelta Move POSIX::localeconv() logic to locale.c

The code currently in POSIX.xs is moved to locale.c, and reworked some
to fit in that scheme, and the logic for the workaround for the Windows
broken localeconv() is made more robust.

This is in preparation for the next commit which will use this logic
instead of (imperfectly) duplicating it.

This also creates Perl_localeconv() for direct XS calls of this
functionality.


  Commit: 8fba1bb961845e5ba27b05a7eaa9a8bb9148ccd5
      
https://github.com/Perl/perl5/commit/8fba1bb961845e5ba27b05a7eaa9a8bb9148ccd5
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: localeconv() unconditional NUMERIC toggle

It is possible to lockout changing the LC_NUMERIC locale.  This is done
in some printf cases where a recursive call could get the radix
character wrong.  But localeconv(), which could be called during this
recursion on some platforms, toggles the locale briefly, without
affecting the surrounding calls; so it can do the toggle
unconditionally.

The previous commit merely moved the functionality of localeconv() from
POSIX.xs to locale.c.  This commit expands upon that.


  Commit: 298099358c8c3c938f80c4c9f79128e0428d6647
      
https://github.com/Perl/perl5/commit/298099358c8c3c938f80c4c9f79128e0428d6647
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Collapse duplicate logic into one instance

A previous commit move the logic for localeconv() into locale.c.  This
commit takes advantage of that to use it instead of repeating the logic.

Notably, this commit removes the inconsistent duplicate logic that had
been used to deal with the Windows broken localeconv() bug.


  Commit: d32325da6a507e347adceb4b098d74ee75acb85c
      
https://github.com/Perl/perl5/commit/d32325da6a507e347adceb4b098d74ee75acb85c
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add branch prediction, comments


  Commit: bb634b4f5b64c570f632f8cc88ed7cfeddf84b6e
      
https://github.com/Perl/perl5/commit/bb634b4f5b64c570f632f8cc88ed7cfeddf84b6e
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M ext/POSIX/POSIX.xs
    M locale.c
    M proto.h

  Log Message:
  -----------
  XXXdelta Add my_strftime8()

This is like plain my_strftime(), but additionally returns an indication
of the UTF-8ness of the returned string


  Commit: 46e1756ca8bc3428641ab3c1183b03cbb6da313d
      
https://github.com/Perl/perl5/commit/46e1756ca8bc3428641ab3c1183b03cbb6da313d
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M embed.h
    M locale.c
    M proto.h

  Log Message:
  -----------
  locale.c: Add utf8ness return param to static fcn

my_langinfo_i() now will additionally return the UTF-8ness of the
returned string.


  Commit: a14d04cc6ac5b5d26f3b8607b50a1499ab0abcdf
      
https://github.com/Perl/perl5/commit/a14d04cc6ac5b5d26f3b8607b50a1499ab0abcdf
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M embed.fnc
    M ext/I18N-Langinfo/Langinfo.xs
    M locale.c
    M proto.h

  Log Message:
  -----------
  XXXdelta Add Perl_langinfo8()

This is like Perl_langinfo() but additionally returns information about
the UTF-8ness of the returned string.


  Commit: 4d9714422701d0ea5e7462cd198358ab77a397d1
      
https://github.com/Perl/perl5/commit/4d9714422701d0ea5e7462cd198358ab77a397d1
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M lib/locale.t

  Log Message:
  -----------
  lib/locale.t: Use I18N::Langinfo, not POSIX::localeconv()

Now that Langinfo is ported to every box, it requires less work than
localeconv(), and offers more choices.  This commit changes to use it,
and for more info when debugging, gets some additional info from it,
while avoiding some calls when not debugging


  Commit: ea7289b2bcf3df0b0d0a83dc9f63446c5ff9157a
      
https://github.com/Perl/perl5/commit/ea7289b2bcf3df0b0d0a83dc9f63446c5ff9157a
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M cpan/version/t/07locale.t

  Log Message:
  -----------
  version::07locale.t: Use I18N::Langinfo, not POSIX::localeconv()

The former is always present; the latter might not be.


  Commit: 258584132119971a2035484398263756dd73b8b2
      
https://github.com/Perl/perl5/commit/258584132119971a2035484398263756dd73b8b2
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M lib/locale_threads.t

  Log Message:
  -----------
  locale_threads.t: Use I18N::Langinfo, not POSIX::localeconv()

The former is always present; the latter might not be


  Commit: ce8b174eae8e8af532bc1273122c02ff22b87c45
      
https://github.com/Perl/perl5/commit/ce8b174eae8e8af532bc1273122c02ff22b87c45
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/run/locale.t

  Log Message:
  -----------
  run/locale.t white space


  Commit: 856a3abe272a91bed83a4a7b83f5f7cf0b2c1266
      
https://github.com/Perl/perl5/commit/856a3abe272a91bed83a4a7b83f5f7cf0b2c1266
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M t/run/locale.t

  Log Message:
  -----------
  run/locale.t: Use langinfo not localeconv


  Commit: 2ba38f3aff0f0670e0a1d0b9909169b68d34caec
      
https://github.com/Perl/perl5/commit/2ba38f3aff0f0670e0a1d0b9909169b68d34caec
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  locale.c: Add fallbacks if no mbtowc()

This add heuristics that work well for non-English locales to determine
if a locale is UTF-8 or not when mbtowc() isn't available.  It would be
a very rare compiler that didn't have that these days, but this covers
that case as best as I have been able to figure out.


  Commit: 3c91fb701e09c9e5fc481bc1b6bc493f899a3094
      
https://github.com/Perl/perl5/commit/3c91fb701e09c9e5fc481bc1b6bc493f899a3094
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M ext/I18N-Langinfo/t/Langinfo.t

  Log Message:
  -----------
  Revert "XXX Temporarily skip on Windows"

This should now be fixed by intervening commits


  Commit: 12a844d88f98769ef8662d03293570c33d7dd88c
      
https://github.com/Perl/perl5/commit/12a844d88f98769ef8662d03293570c33d7dd88c
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M ext/POSIX/lib/POSIX.pm

  Log Message:
  -----------
  Bump posix version


  Commit: 463af81974235963ca85ec6937a7dbb716d8f5d6
      
https://github.com/Perl/perl5/commit/463af81974235963ca85ec6937a7dbb716d8f5d6
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M locale.c

  Log Message:
  -----------
  XXX temp win32 debugging


  Commit: a20a6632c1d960acc3536ef87ae34b9701d98521
      
https://github.com/Perl/perl5/commit/a20a6632c1d960acc3536ef87ae34b9701d98521
  Author: Karl Williamson <[email protected]>
  Date:   2022-08-14 (Sun, 14 Aug 2022)

  Changed paths:
    M ext/I18N-Langinfo/t/Langinfo.t

  Log Message:
  -----------
  langinfo


Compare: https://github.com/Perl/perl5/compare/064a7803fda6...a20a6632c1d9

Reply via email to