i have the following code in my zf project :
$index = Zend_Search_Lucene::open(APPLICATION_PATH . '/cache/search_index');
        $doc = new Zend_Search_Lucene_Document();
        $title = "سلام سینا xxx sad";
        $doc->addField(Zend_Search_Lucene_Field::Text('title', $title));
        $index->addDocument($doc);
        $index->commit();
        $index->optimize();
        echo "Index contains " . $index->count() . " documents.\n\n";
        $results = $index->find('xxx');
        foreach ($results as $res) {
            var_dump($res->title);
        }
when var_dump 开发者_如何学Goperforms output -> string(39) "سینا جان xxx sad"
when i user utf_decode string(25) "س�?ا�? س�?�?ا xxx sad"
how can i decode that correctly ! :(?
i already used the solution in this SOF quesion -> lucene encoding problem in zend framework
but not works and a notice error added about iconv !
plz help :)
Fixed by this code:
$index = Zend_Search_Lucene::open(APPLICATION_PATH . '/cache/search_index');
    $doc = new Zend_Search_Lucene_Document();
    $title = "سلام سینا xxx sad";
    $doc->addField(Zend_Search_Lucene_Field::Text('title', $title,"UTF8"));
    $index->addDocument($doc);
    $index->commit();
    $index->optimize();
    echo "Index contains " . $index->count() . " documents.\n\n";
    var_dump($index->getDocument(9));
    echo "Search";
     $results = $index->find('سینا');
   foreach ($results as $res) {
        var_dump($res->title);
    }
    die(1); 
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论