i have ajax function that looks like this:
jQuery.ajax({
type: 'POST',
data: {
action: 'get_data',
article_id: some_var
},
url: 'http://www.example/test.php',
success: function(msg) {
jQuery('#some_div').html(msg);
}
});
In test.php i have mysql query that gets row from base, with id that is equal to article_id. It works good. BUT i have some serbian language characters in database, and when ajax returns that characters, they look like this: “Ž” is “�”, and “Š” is “?”.
Data is corectly stored in mysql (utf8 connections, colations and all other stufs), html page encoding is utf8… I am missing something, i dont know what…
Resolved, i add after connection to base: mysql_query(“SET NAMES utf8”); mysql_query(“SET CHARACTER SET utf8”); mysql_query(“SET COLLATION_CONNECTION=’utf8_general_ci'”); . I thought that this is important only when inserting data to base