Yii Framework Forum: Pagination Fails With An Utf8 Char In Params - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Pagination Fails With An Utf8 Char In Params Rate Topic: -----

#1 User is offline   charmi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 18-August 12

Posted 07 May 2013 - 02:38 PM

The pagination generated urls fails to open when they contain utf8 characters:

Exemple:
http://newsfeed.tn/i...=AR%2BFR&page=2

=>

http://newsfeed.tn/i...an=AR+FR&page=2

How to build urls with utf8 parameters
0

#2 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 530
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 07 May 2013 - 02:52 PM

Can not reproduce the problem. Are you manually doing uft8_decode or utf8_encode somewhere?
Can you show the code that creates the pager?
0

#3 User is offline   charmi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 18-August 12

Posted 08 May 2013 - 04:56 PM

<?php
/* @var $this SiteController */


$this->pageTitle=Yii::app()->name;


?>


<?php
Yii::app()->clientScript->registerScript('search',
    "var ajaxUpdateTimeout;
    var ajaxRequest;
    $('input#q').keyup(function(){
        ajaxRequest = $(this).serialize();
        clearTimeout(ajaxUpdateTimeout);
        ajaxUpdateTimeout = setTimeout(function () {
            $.fn.yiiListView.update(
                'ajaxListView',
                {data: ajaxRequest}
            );
            
            
        },
        5);
    });

     $('input#lan').change(function(){
        ajaxRequest = $(this).serialize();
        clearTimeout(ajaxUpdateTimeout);
        ajaxUpdateTimeout = setTimeout(function () {
            $.fn.yiiListView.update(
                'ajaxListView',
                {data: ajaxRequest}
            );
        },
        5);
    });
    
    ;"
);

$this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemsTagName' => 'table',
	'itemsCssClass' => 'thread',
	'itemView'=>'_view',
	'template' => '{pager}{sorter}{items}{pager}',
	'cssFile' => '/css/test.css',
	'enableHistory' => true,
	'id'=>'ajaxListView',
	'pager'=>array(
      'class'=>'CLinkPager',
      'header'=>'',
      'cssFile'=> '/css/test.css',
   ),
	'sortableAttributes'=>array(
        'title' => 'Titre',
        'create_date'=>'Date',
        )

))
?>
<br>




Pager fails when I am searching with a french word like président.
My search form is here

<?php
			echo CHtml::beginForm(CHtml::normalizeUrl(array('site/index')), 'get', array('id'=>'filter-form'))
			. CHtml::textField('q', (isset($_GET['q'])) ? $_GET['q'] : '', array('id'=>'q', 'size' => '20'))
			. CHtml::dropDownList('lan', (isset($_GET['lan'])) ? $_GET['lan'] : 'AR+FR', array('AR+FR'=> 'Multi-langue', 'AR' => 'عربي', 'FR' => 'français'))
			. CHtml::submitButton('Search', array('name'=>'','text'=>'Chercher', 'class'=>'button' ))
			. CHtml::endForm() .'<br>';
			?>


Thanks.

View PostCeBe, on 07 May 2013 - 02:52 PM, said:

Can not reproduce the problem. Are you manually doing uft8_decode or utf8_encode somewhere?
Can you show the code that creates the pager?

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users