From a4f7ef2c2fde3e7a397a074cbf333fcaab0094da Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 22 Apr 2025 11:00:27 -0600 Subject: [PATCH] locale.c: Add debug for MB_CUR_MAX The latest MacOS release has locales that set this wrongly. This isn't the first time this has been a problem. Add a debugging line that can easily be enabled to check for problems that may arise in the field. --- locale.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/locale.c b/locale.c index 9376e2ed81b0..38b25b853c55 100644 --- a/locale.c +++ b/locale.c @@ -3851,6 +3851,9 @@ S_new_ctype(pTHX_ const char *newctype, bool force) const int mb_cur_max = MB_CUR_MAX; + DEBUG_Lv(PerlIO_printf(Perl_debug_log, "MB_CUR_MAX=%d, utf8?=%d\n", + mb_cur_max, PL_in_utf8_CTYPE_locale)); + if (mb_cur_max > 1 && ! PL_in_utf8_CTYPE_locale /* Some platforms return MB_CUR_MAX > 1 for even the "C" locale.