tokenize words with foreign language chars problem
| From: | Javier Leyba | Date: | Wed, 02 Aug 2000 13:38:26 +0000 |
| Subject: | tokenize words with foreign language chars problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9685@lists.php.net to get a copy of this message | ||
Hi !
Thanks for your reply.
I've the same problem with your example. Do you know if I need to setup an special
configuration for foreign languages support ?
If your example works well in your server and bad on my server I think we have different
configuration directives. I'm running PHP 4 on a RedHat Linux with Apache.
Thanks in advance.
*********** REPLY SEPARATOR ***********
On 01/08/00 at 03:46 p.m. Christensen, BruceX R wrote:
>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