RE: [PHP] tokenize words with foreign language chars problem

From: Date: Tue, 01 Aug 2000 22:46:17 +0000
Subject: RE: [PHP] tokenize words with foreign language chars problem
Groups: php.general 
Request: Send a blank email to php-general+get-9593@lists.php.net to get a copy of this message
It seems to work fine for me. I ran this code: $string = 'a b c +d +e -f -g à +á +âã -Ê -g -Ê '; echo "'$string'\n"; $tokens = preg_split("/[^\w+-]+/", $string); print_r ($tokens); And got this as the output: 'a b c +d +e -f -g à +á +âã -Ê -g -Ê ' Array ( [0] => a [1] => b [2] => c [3] => +d [4] => +e [5] => -f [6] => -g [7] => à [8] => +á [9] => +âã [10] => -Ê [11] => -g [12] => -Ê [13] => ) --Bruce Bruce Christensen Intel Corporation brucex.r.christensen@intel.com -----Original Message----- From: Javier Leyba [mailto:jleyba@sabueso.net] Sent: Tuesday, August 01, 2000 1:39 PM To: php-general@lists.php.net Subject: [PHP] tokenize words with foreign language chars problem Hi All ! My application receives words (may be separated with + or - chars) to do a search into the database. I need to split the string I received to construct the database query string, but I've many errors when people insert words with accents, etc (for example in Spanish language). To tokenize I'm using the function $token = preg_split("/[^\w\+\-]/", $search_word); with the problem related above. Also I've tried to use rawurlencode function previous to call preg_split, but if people insert the word "Clarín" after rwaurlencode I've the word "Clar%EDn" and after preg_split I 've 2 words "Clar" and "EDn" !!! How can I solve the problem ? Any help will be appreciated... Javier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#9593) next »