From 98a61c74eedd5cc8be9c2dc9b62b3a7fce30cd1d Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 04 Sep 2015 04:11:50 -0400
Subject: [PATCH] Fix various issues with Turkish (and similar) locales (#1490519)

---
 CHANGELOG                  |    1 +
 program/include/rcmail.php |    8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index a0d9774..3ba7ce5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -10,6 +10,7 @@
 - Fix so adding CC/BCC recipients from the sidebar unhides compose form fields in Classic skin (#1490472)
 - Fix so gc.sh script removes also expired sessions from sql database (#1490512)
 - Fix support for Mozilla-based browsers, e.g. Pale Moon (#1490517)
+- Fix various issues with Turkish (and similar) locales (#1490519)
 
 RELEASE 1.0.6
 -------------
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 350b54f..1d4751e 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -175,9 +175,11 @@
         // set localization
         setlocale(LC_ALL, $lang . '.utf8', $lang . '.UTF-8', 'en_US.utf8', 'en_US.UTF-8');
 
-        // workaround for http://bugs.php.net/bug.php?id=18556
-        if (version_compare(PHP_VERSION, '5.5.0', '<') && in_array($lang, array('tr_TR', 'ku', 'az_AZ'))) {
-            setlocale(LC_CTYPE, 'en_US.utf8', 'en_US.UTF-8');
+        // Workaround for http://bugs.php.net/bug.php?id=18556
+        // Also strtoupper/strtolower and other methods are locale-aware
+        // for these locales it is problematic (#1490519)
+        if (in_array($lang, array('tr_TR', 'ku', 'az_AZ'))) {
+            setlocale(LC_CTYPE, 'en_US.utf8', 'en_US.UTF-8', 'C');
         }
     }
 

--
Gitblit v1.9.1