I have Database on localhost (xampp, mysql). I have some symbols cyrillics (russian symbols). All fields of database are setting as utf8mb4_general_ci. From Database I receive data to application CLR windows form (visual studio). It's work correctly. If I try change data at database from application, my string (with cyrillics) change to ??????????. English symbols are displayed correctly..
I add a reference MySql.Data to project CLR, then I write code.
I tried to change encoding from utf8 to cp1251 or cp866, but it didn't help.. I changed encoding MyForm.h to UTF8, but it didn't help also..
Help plz...
What I have tried:
String^ constr = "Server=127.0.0.1;Uid=root;Pwd=;Database=travelagency;SSL Mode=None";
MySqlConnection^ con = gcnew MySqlConnection(constr);
String^ utf8 = "SET NAMES 'utf8'; SET CHARACTER SET 'utf8'; SET SESSION collation_connection = 'utf8_general_ci';";
String^ sql_set = utf8 + "";
String^ fio = "Васильев Владимир Евгеньевич";
String^ tel = "89161221111";
String^ email = "ter@mail.ru";
String^ adress = "г. Москва, Федоровская ул., д. 15";
String^ sql_query = sql_set;
sql_query += "insert into clients (fio, tel, email, adress) values('" + fio + "','" + tel + "','" + email + "','" + adress + "')";
MySqlCommand^ cmd = gcnew MySqlCommand(sql_query, con);
con->Open();
MySqlDataReader^ dr = cmd->ExecuteReader();
MessageBox::Show("Запись добавлена!");
dr->Close();
con->Close();