I have a form with a input that accept UTF-8 characters:
<form method="post" action="faz-personagem.php" accept-charset="UTF-8">
<div class="row">
<label for="nome">Nome</label>
<input type="text" name="nome">
</div>
...
<button type="submit">Enviar</button>
</form>
And a script that send the data to a database:
<?php
header("Content-Type: text/html;charset=UTF-8");
$conexao = mysql_connect('localhost', 'root', 'pass');
mysql_select_db('pan-tactics');
$nome = $_POST['nome'];
$nome = utf8_encode($nome);
$sql = "INSERT INTO personagens VALUES";
$sql .= "('$nome')";
$resultado = mysql_query($sql);
echo 'Personagem criado com sucesso.';
mysql_close($conexao);
?>
I also have specified in the creation of the database the collation utf8_unicode_ci and yet what I get is wrong special characters:
What can I do to fix it?
