Serverside VS Normal
Serverside VS Normal
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.
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.
This discussion has been closed.
Replies
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 */
Allan