summaryrefslogtreecommitdiff
path: root/inc/utf8.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-11-12 21:22:26 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-11-12 21:22:26 +0100
commit3161005d07beb46bb8a866ec56a768938571ec9d (patch)
treeeef6ac12c9aa09de859eba984ddc7990c82a198a /inc/utf8.php
parenta21383af58203bf0e6dc36a07ea78fae0b58c1ef (diff)
downloadrpg-3161005d07beb46bb8a866ec56a768938571ec9d.tar.gz
rpg-3161005d07beb46bb8a866ec56a768938571ec9d.tar.bz2
check for unicode preg capabilities in UTF-8 lib FS#2636
We now have two defines for checking for UTF-8 and Unicode property support in PREG and use them to work around FS#2636 on older systems.
Diffstat (limited to 'inc/utf8.php')
-rw-r--r--inc/utf8.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/inc/utf8.php b/inc/utf8.php
index 6fab8502c..c944667f7 100644
--- a/inc/utf8.php
+++ b/inc/utf8.php
@@ -17,6 +17,25 @@ if(!defined('UTF8_MBSTRING')){
}
}
+/**
+ * Check if PREG was compiled with UTF-8 support
+ *
+ * Without this many of the functions below will not work, so this is a minimal requirement
+ */
+if(!defined('UTF8_PREGSUPPORT')){
+ define('UTF8_PREGSUPPORT', (bool) @preg_match('/^.$/u', 'ñ'));
+}
+
+/**
+ * Check if PREG was compiled with Unicode Property support
+ *
+ * This is not required for the functions below, but might be needed in a UTF-8 aware application
+ */
+if(!defined('UTF8_PROPERTYSUPPORT')){
+ define('UTF8_PROPERTYSUPPORT', (bool) @preg_match('/^\pL$/u', 'ñ'));
+}
+
+
if(UTF8_MBSTRING){ mb_internal_encoding('UTF-8'); }
if(!function_exists('utf8_isASCII')){