mysql fields with foreign characters returned as null
mysql fields with foreign characters returned as null
asle
Posts: 96Questions: 28Answers: 0
If I have some foreign characters (Norwegian) in a field it is returned as null in the json response. The database and table are UTF-8. Also the encoding of the HTML page and PHP script page (using server-side) is UTF-8. Any idea how I fix this? If the field content is "Oslo" it is returned, if it is "Ås" it is returned as null.
This discussion has been closed.
Replies
http://datatables.net/forums/discussion/8963/aadata-return-null-when-there-are-special-characters-aaeoe/p1
But I wonder how to use the code for searching. I read this post:
http://datatables.net/forums/discussion/675/failed-to-search-server-side-data-utf8/p1#Item_4
It says to "You can put the following codes after MySql connections.." but whery do I put it and how do i change my code:
[quote]
//To send utf8 data to MySql - needed if you need to inject utf8 data for search
mysql_query("SET character_set_client=utf8", $gaSql['link']);
mysql_query("SET character_set_connection=utf8", $gaSql['link']);
//To read utf8 data from MySql - needed if your result set contains utf8 data
mysql_query("SET character_set_results=utf8", $gaSql['link']);
$rResult = mysql_query( $sQuery ) or die(mysql_error());
[/quote]
I have used the server_processing.php and i think this is where the search is done?
[code]
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
[/code]