I wrote script that are sending data from HTML form to server using ajax request.
$.ajax({
type: $(this).attr('method'),
cache: false,
url: $(this).attr('action'),
data: $(this).serialize(),
dataType: 'json'
});
I input data into my HTML form with:
name = 'ładna pogoda'
My $_POST
data in PHP script looks like: Array ( [name] => Ĺadna pogoda )
Data stored in MySQL: ?adna pogoda
It's possible to convert data to get utf-8 characters in my php script after serialize() data in javascript?
UPDATE:
My MySQL table was encoded with utf8-general-ci
but somehow my columns where I stored data was latin1
. When I changed it to table default
it starts working.