Insert into the database by recording in half

3

I get the name of the news and insert it in another table, but one of the fields is going in half, follow the image of print :

Database

Sourcecodewhereyousend:

<inputname="nomenoticia" type="hidden" id="nomenoticia"
       value="PC realiza apreensão de arma de fogo e droga no Bairro Jardim Esperança." size="80"
       maxlength="100">

Excerpt from the code I'm doing the insert

     $noticia = $_POST['noticia'];
     $titulonoticia = $_POST['nomenoticia'];
     $nome = $_POST['nome'];
     $comentario = $_POST['comentario'];
     $status = $_POST['status'];


    $sqlInsert= "INSERT INTO comentarios   (noticia,nomenoticia,nome,comentario,status) VALUES (:noticia,:nomenoticia,:nome,:comentario,:status)";
    $stmt = DB::prepare($sqlInsert);
    $stmt->bindParam("noticia", $noticia);
    $stmt->bindParam("nomenoticia", $titulonoticia);
    $stmt->bindParam("nome", $nome);
    $stmt->bindParam("comentario", $comentario);
    $stmt->bindParam("status", $status);
    $stmt->execute();
    
asked by anonymous 15.03.2015 / 19:29

1 answer

5

The cut is happening when you find an accent. So the problem is the incompatibility between the encoding of the data being sent by the page and the waiting encoding in the database column. Assuming that the database encoding is actually utf8_general_ci and that it's hard to be wrong about this and that there's nothing in the middle of doing conversions, you can only conclude that the specific page that is sending the data is coded differently than expected, even if inadvertently.

In fact, the author acknowledged that the encoding of the page for UTF-8 was missing.

    
15.03.2015 / 20:57