Cakephp:用阿拉伯语文本搜索

时间:2015-01-10 21:10:13

标签: cakephp character-encoding

我的网站有问题。我有法语和阿拉伯语,除搜索外,一切正常。当我搜索时 法语文本,我得到了结果,但是当我用阿拉伯语写文本时 语言我得到这样的Unicode字符:

原文:

enter image description here

调试结果:

enter image description here

我的配置database.php

'encoding' => 'utf8',

defaut.ctp

echo $this->Html->charset();
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

我的搜索功能

function search($query = null)
{
    $this->Activite->locale = Configure::read('Config.language');
    $query = $this->request->query['query'];
    //debug($this->request);die();
    if(isset($query))
    {
        $this->paginate = array(
            'limit' => 4,
            'fields' => array('Activite.*', 'Thumb.file'),
            'order' => array('Activite.created' => 'Desc'),
            'conditions' => array(
                'deleted' => false,
                'Activite.titre like' => "%$query%"
            )
        );
        $search_result = $this->paginate('Activite');
        $this->set('search_result',$search_result);

    }
    else
    {
        $this->Session->setFlash("Veuillez saisir votre recherche .","flash_warning");
        $this->redirect(array('controller' => 'activites','action' => 'index'));
    }
}

表单元素:

<div class="right-sidebar-block">
      <h3 class="dotted_line"><?php echo __('Recherche');?></h3>
      <div class="tout">
        <?php echo $this->Form->create('Activite',array('type' => 'GET','action' => 'search')) ?>
        <?php echo $this->Form->input('query',array('label' => false,'div' => false)); ?>
        <?php echo $this->Form->submit(__('ok'),array('div' => false,'class' => 'myButton')); ?>
      </div>
    </div>

0 个答案:

没有答案