note 88567 added to function.iconv

From: Date: Thu, 29 Jan 2009 10:37:09 +0000
Subject: note 88567 added to function.iconv
Groups: php.notes 
Request: Send a blank email to php-notes+get-149936@lists.php.net to get a copy of this message
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>"; } ---- Server IP: 124.217.231.13 Probable Submitter: 60.49.101.237 ---- Manual Page -- http://www.php.net/manual/en/function.iconv.php Edit -- https://master.php.net/note/edit/88567 Del: integrated -- https://master.php.net/note/delete/88567/integrated Del: useless -- https://master.php.net/note/delete/88567/useless Del: bad code -- https://master.php.net/note/delete/88567/bad+code Del: spam -- https://master.php.net/note/delete/88567/spam Del: non-english -- https://master.php.net/note/delete/88567/non-english Del: in docs -- https://master.php.net/note/delete/88567/in+docs Del: other reasons-- https://master.php.net/note/delete/88567 Reject -- https://master.php.net/note/reject/88567 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149936) next »