With whatever I do (php & meta Content-type headers as utf-8) and all the htmlspecialchars, utf8_de- and encode etc. I just can't seem to insert text the right way into the table. Even returning it in a div, checking with alerts etc. nothing seems to get this right:
This is inserted into the MySQL table:
America’s Greatest Rock ‘N’ Roll Band – have
it should be:
America’s Greatest Rock ‘N’ Roll Band – have
in the jQuery script I use:
var ch_title = encodeURIComponent(ch_title);
var ch_descr = encodeURIComponent(ch_descr);
the PHP insert script has:
$ch_descr = "$_POST[ch_descr]";
$ch_descr = nl2br("$ch_descr");
$ch_descr = mysqli_real_escape_string($conn,$ch_descr);
Does anyone know how to get this right?
Solution I used this to solve the problem, including the doctype and headers:
<!DOCTYPE html>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
and for PHP:
header ('Content-type: text/html; charset=utf-8');
$ch_descr = iconv('UTF-8', 'ASCII//TRANSLIT', $ch_descr);
$ch_descr = mysqli_real_escape_string($conn,$ch_descr);