Serverside VS Normal

Serverside VS Normal

memememe Posts: 6Questions: 0Answers: 0
edited March 2012 in General
Hi.

I'm using datatables to show some tables from mysql db.

All the tables have several fields that content spanish text.

Example:

Nombre
María, José, Antonio, Mario, etc... (some of them with accent)

Apellidos
Pérez, López, Fuentes, etc.

If I use serverside with:

$sWhere .= $aColumns[$i]." LIKE CONVERT( _utf8 '%".mysql_real_escape_string( $_GET['sSearch'] )."%' USING latin1 ) COLLATE latin1_spanish_ci OR ";

when I search "Mari", the grid show 2 rows, one for Mario and one for María, but the grid cell doesn't show the text "María" because has an accent in vowel "i".

If I don't use serverside:

when I search "Mari", the grid only show 1 row for Mario, but it should search for María too, and It doesn't.

How could I have the best from this "two worlds" in a unique implementation ?


Thanks in advance for your help.

Replies

  • totortotor Posts: 1Questions: 0Answers: 0
    You can try to update the php script available on this page:
    http://datatables.net/beta/1.8/examples/server_side/server_side.html

    You need that the collation of the database fields is in utf8 ( with _ci it's better).
    So just update the php script with:
    - utf8_decode the $_GET['sSearch']
    - utf8_encode the /* General output */
  • allanallan Posts: 63,541Questions: 1Answers: 10,476 Site admin
    Have a look at this post from Stephanie: http://datatables.net/forums/discussion/675/failed-to-search-server-side-data-utf8/p1#Item_4 .

    Allan
This discussion has been closed.