note 88567 deleted from function.iconv by thiago
| From: | thiago@php.net | Date: | Thu, 29 Jan 2009 11:25:17 +0000 |
| Subject: | note 88567 deleted from function.iconv by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149938@lists.php.net to get a copy of this message | ||
Note Submitter: footballfreetv at gmail dot com
----
converting arabic characters to utf-8 and encode it again to utf-8 to use it with regex.
this example works only with sites that provide windows-1256 charset (arabic characters)
here is the example:
$content = get_content("$url2"); // content
$tmpContent=iconv("windows-1256", "utf-8", "$content"); //encoding the
grabbed content and change it to utf-8 :D
$encoded= utf8_encode($tmpContent); // now encode it again to utf8 format to start matching ;)
$encoded_phrase=utf8_encode('Ù
ثاÙ');//encode our phrase to match the encoded
content
$pattern='/"ftnh",(.*?),(.*?)'."($encoded_phrase)".'(.*?),/';
//this pattern will get all words near "the encoded word;"
if(preg_match_all($pattern,$encoded,$out,PREG_PATTERN_ORDER))
{
echo "topics found:<br>";
}