Script does not save full word if you have accent

0

I have a script that works great on my dashboard, but I put it on another page and it is not working.

When a word has an accent, eg "Natália" the system is saving in the bd just "Nat" excluding the rest that is part of the word.

include "painel_dados/bd.php";

// recebendo os dados do formulario
$nome   = $_POST['nome'];
$cpf    = $_POST['cpf'];

$query = $mysqli->prepare('INSERT INTO 'associados' ('nome', 'cpf') values (?,?)')or die($mysqli->error);
$query->bind_param('ss', $nome, $cpf);
$query->execute();

Where am I going wrong? If I give one

  

echo $ name;

The word appears right. Just in time to save in the bd it is incomplete.

    
asked by anonymous 28.09.2018 / 21:15

1 answer

2

I discovered the error. The page where the form was was

  

charset = iso-8859-1

I switched to

  

UTF-8

And it worked

    
28.09.2018 / 21:24