summaryrefslogtreecommitdiff
path: root/locale.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-02-16 22:01:44 -0700
committerKarl Williamson <khw@cpan.org>2019-03-04 13:01:37 -0700
commit5b64f24c7b79ab856726455c6cee2237c97dd6dd (patch)
tree0dbfaaa998682e77fc45f032b8eaf37a2789532f /locale.c
parent2e3ef32f4acc106de6ae8170099f09a36d4ef490 (diff)
downloadperl-5b64f24c7b79ab856726455c6cee2237c97dd6dd.tar.gz
locale.c: Tighten turkish locale tests on C99 platforms
C99 has wide character case changing. If those are available, use them to be surer we have a Turkic locale.
Diffstat (limited to 'locale.c')
-rw-r--r--locale.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/locale.c b/locale.c
index 3a2e49d72d..e2bb54ebdf 100644
--- a/locale.c
+++ b/locale.c
@@ -53,6 +53,9 @@
#ifdef I_WCHAR
# include <wchar.h>
#endif
+#ifdef I_WCTYPE
+# include <wctype.h>
+#endif
/* If the environment says to, we can output debugging information during
* initialization. This is done before option parsing, and before any thread
@@ -1528,7 +1531,16 @@ S_new_ctype(pTHX_ const char *newctype)
/* UTF-8 locales can have special handling for 'I' and 'i' if they are
* Turkic. Make sure these two are the only anomalies. (We don't use
* towupper and towlower because they aren't in C89.) */
+
+#if defined(HAS_TOWUPPER) && defined (HAS_TOWLOWER)
+
+ if (towupper('i') == 0x130 && towlower('I') == 0x131) {
+
+#else
+
if (toupper('i') == 'i' && tolower('I') == 'I') {
+
+#endif
check_for_problems = TRUE;
maybe_utf8_turkic = TRUE;
}