The first thing I would do is to convince those guys (RedHat) to compile
PCRE with UTF-8 and Unicode stuff support (that's 2 different build
options). They have probably forgot to include them.
Ok, so to detect if you have UTF-8 support.. uhm we could add a function to
do that (PCRE exports that information), but I think you want something
quicker than asking everybody to upgrade php :P You can always try to match
a simple thing and see if it returns an error or not.
e.g. if (!preg_match('/\pL/u', 'a')) die('bastard');
Nuno
----- Original Message -----
From: "Andries Seutens" <[EMAIL PROTECTED]>
To: <php-i18n@lists.php.net>
Sent: Wednesday, June 27, 2007 6:36 PM
Subject: [PHP-I18N] Check if PCRE has UTF-8 support compiled in
Dear all,
In the Zend Framework we have written a filter to filter anything but
alpha an numeric characters from a string. The regular expression for this
filter looks like so:
$result = preg_replace('/[^\p{L}\p{N}\s]/u', '', '!!testing123!!');
Apperently, on some systems like RHEL however, this regular expression
seems to fail. The reason that it is failing for you appears to be that
your PCRE does not have UTF-8 support compiled in? This is likely the
result of the particular distribution not having used the --enable-utf8
option.
What this means to us is that the class should become aware of whether
such support is available, and act accordingly.
My question to you guys is, how would such a check for support best be
done? Perhaps detect the error condition, which would only occur in the
event that the system does not have utf-8 support? But how (preferably
without going down the dirty path .... )?
Best regards,
Andries Seutens
http://andries.systray.be
--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php