From c4f9ad6e96ba08fe27315d1607270de1f678f8f1 Mon Sep 17 00:00:00 2001 From: Robin Johnson Date: Sat, 10 Aug 2002 11:10:09 +0000 Subject: [PATCH] accented characters function --- ChangeLog | 2 ++ libraries/string.lib.php3 | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8f87d2a96..c91429588 100755 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,8 @@ $Source$ - Added CVS tags to scripts * lang/*.inc.php3: - All languages neatened by lang/sort_lang.sh script. + * libraries/string.lib.php3: + - Added function to match accented characters 2002-08-08 Robin Johnson * Documentation.html: diff --git a/libraries/string.lib.php3 b/libraries/string.lib.php3 index e366f1738..b9b5d0823 100644 --- a/libraries/string.lib.php3 +++ b/libraries/string.lib.php3 @@ -224,6 +224,28 @@ if (!defined('PMA_STR_LIB_INCLUDED')) { || PMA_STR_numberInRangeInclusive($ord_c, $ord_tab, $ord_CR)); } // end of the "PMA_STR_isSpace()" function + /** + * Checks if a character is an accented character + * + * @param string character to check for + * + * @return boolean whether the character is an upper alphabetic one or + * not + * + * @see PMA_STR_numberInRangeInclusive() + */ + function PMA_STR_isAccented($c) + { + $ord_min1 = 128; //ord('A'); + $ord_max1 = 154; //ord('Z'); + $ord_min2 = 128; //ord('A'); + $ord_max2 = 154; //ord('Z'); + $ord_c = ord($c); + + return PMA_STR_numberInRangeInclusive($ord_c, $ord_min1, $ord_max1) + || PMA_STR_numberInRangeInclusive($ord_c, $ord_min2, $ord_max2); + } // end of the "PMA_STR_isAccented()" function + /** * Checks if a character is an SQL identifier @@ -238,6 +260,7 @@ if (!defined('PMA_STR_LIB_INCLUDED')) { function PMA_STR_isSqlIdentifier($c, $dot_is_valid = FALSE) { return (PMA_STR_isAlnum($c) + || PMA_STR_isAccented($c) || ($c == '_') || ($c == '$') || (($dot_is_valid != FALSE) && ($c == '.'))); } // end of the "PMA_STR_isSqlIdentifier()" function