0

I am experiencing unexpected behavior. When saving a record in the database and when getting the created record. I observe that the characters with an accent are erroneously encoded. When verifying the database using datagrip, I observe that the value of the affected field is properly encoded. But if I check with the mysql client I see that the values ​​are badly encoded

In the object obtained after saving the value of the affected field looks like this

S\u00f3ni

In datagrip I get

Soni

In mysql client I get

S�ni

When verifying the encoding of the table with the command show table status where name like 'table_name' I get the value utf8_general_ci in the Collation column

When executing the statement show create table table_name; I observe the following

) ENGINE=MyISAM DEFAULT CHARSET=utf8 |

Finally in php.ini I get the following

default_charset = "UTF-8"

update 0

The database collation

SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "dbname";

+----------------------------+
| default_character_set_name |
+----------------------------+
| latin1                     |
+----------------------------+

How do I get the characters to be properly encoded?

Thanks for the assistance

Mario
  • 4,784
  • 3
  • 34
  • 50
  • 1
    Use UTF-8 consequently _everywhere_. In your mysql client, run these 3 commands: `SET character_set_client='UTF8'; SET character_set_results='UTF8'; SET character_set_connection='UTF8';` which will set the client and the transport to utf-8 – Honk der Hase Jun 13 '22 at 06:07
  • [UTF-8 Everywhere](https://utf8everywhere.org/) and [UTF-8 all the way through](https://stackoverflow.com/questions/279170/). – JosefZ Jun 13 '22 at 10:46
  • 1
    See also "black diamond" in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James Jun 20 '22 at 15:46

0 Answers0