I post data from client to php, here is how my post data seems in client:
I click add and post this string to php with ajax call here how posted data seem in ajax parameter;
//username ="Uğur Akkaynak" so its ok.
var params = {
action: "saveAdObjects",
username_: username,
}
$.ajax({
url: "../../Controller/ActiveDirectoryController.php5",
type: "POST",
async:false,
dataType: "json",
data: params,
success: function (result)...
In php file I check the posted variable:
var user = $_POST["username"]; //UÄŸur Akkaynak wtf!
so problem is clear, strings broken in php, I know I need change encoding in php file and tried these:
header('Content-type: text/plain; charset=utf-8');
utf8_encode($_POST["username"]);// Uğur Akkaynak
mb_convert_encoding ($_POST["username"],'utf-8'); // UÄŸur Akkaynak
What should I do get $_POST["username"] as 'Uğur Akkaynak' like posted from client