0

I cannot INSERT Vietnamese strings into the database that expects char utf8.
There is an error with the font.

Ex:

title: Lê Việt Hải Dương
info: Dương IT 911

Here is my code:

$title =  $_POST['title'];
$info =  $_POST['title'];
$query = "INSERT INTO `nick` ( `title`,  `info`) VALUES ('$title','$info')";
$insert_count = $db->exec($query);

This is what appears in the database:

For title:

Lê Vi?t H?i D??ng

For info:

D??ng IT 911

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135

1 Answers1

0

I hope these help you !


  1. First Check That if your file saved in utf-8 !
  2. Put your mysql character encoding on utf-8 !

    mysqli_set_charset($connection,"utf8");

  3. Now if you use mysql go to phpmyadmin and select your database and then go to operations tab and in the collation section change your collation in utf-8

  4. The last thing i can tell to you is to check your table , collation ! open your tables and go to operations tab and find collation , and change it !!


Good luck ! I hope it helps you <3

Mr.Apr
  • 66
  • 1
  • 6