Special Characters and Pagination
I’m using cakephp with charset=iso-8859-1. I know, I’d love to be using UTF-8, but this would be a bigger problem.
The thing is, when I have a special character like “ñ” the pagination links break.
If I don’t use any special characters, pagination works fine.
The controller
$this->paginate = array(
'limit' => self::MAX_PRODUCTOS_POR_PAGINA,
'order' => 'Producto.id DESC',
'conditions' => array($conditions, 'Producto.visible' => true)
);
$this->set('productos', $this->paginate());
The View:
echo $this->paginator->next(' Siguiente > ', null, ' Siguiente > ', array('class' => 'disabled'));
For the “next page” link
I should get this link:
http://mysite.com.ar/Productos/buscar/señuelos/page:2
Instead, I’m getting:
http://mysite.com.ar/Productos/buscar/se%F1uelos
Any Ideas?
ñ is %F1 in html entity so thats not wrong, it’s weird that it broke the pagination, before you couldn’t put ñáéíóú in urls so urlencode was used you can always use ulrdecode so it shows ñ
The cakephp way of doing it would be to set the escape option to false so it won’t put a html entity instead of the ñ like this
make sure this doesn’t break with any parameter 😀
look the api for more info