The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
[SOLVED] Arabic encoding with preg_match_all
HELLO ,
i try discovery of banned words when users posted new post , but i have a problem only Only the discovery of English words, I think that the problem is in the Arabic language encoding , I tried to solve the problem by PHP Code:
Code:
$wordss = "هالو|مرحبا|google.com"; $bwords = explode("|", $wordss); //$string = $vbulletin->GPC['message']; $string = 'BLA BLA مرحبا BLA BLA google.com BLA BLA BLA '; $matchFound = preg_match_all( "/\b(" . implode($bwords,"|") . ")\b/i", $string, $matches ); $words = array_unique($matches[0]); print_r($words); output : google.com but Must be : google.com,مرحبا |
#3
|
||||
|
||||
Quote:
i change /i to /iu and try it on Different places - on online external php file by [/iu] only - > works good - on localhost vbulletin plugin by [/i] only - > works good but .. - on localhost external php file - > don't work - on online vbulletin plugin - > don't work so .. i Become confused :erm: , i don't know what's the wrong --------------- Added [DATE]1416112678[/DATE] at [TIME]1416112678[/TIME] --------------- UPDATE : when i convert php files to encoding ANSI , Results appear in Arabic by pattern "/\b(" . implode($bwords,"|") . ")\b/i" but on plugin how i solve this problem ? |
#4
|
|||
|
|||
I can't get it to work on my test system either, so I'm afraid I'm stumped. I googled to try to find an answer, but the only thing i found was something that mentioned that it's possible that some versions of php don't handle UTF-8 matching correctly.
|
#5
|
||||
|
||||
Quote:
But I do not think this is the reason [php versions] , because the code work well in an external file on the same site withot encoding it but on vb plugin don't work . anyway , can i do what i want by another way ? matching banned words and print it with no problem with the Arabic words . --------------- Added [DATE]1416157331[/DATE] at [TIME]1416157331[/TIME] --------------- UPDATE : I FOUND THE Solution : \b detects word boundaries, remove them to get a regular match. JUST USE pattern Code:
"/(" . implode($bwords,"|") . ")/i " |
Благодарность от: | ||
kh99 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|