I am using ado.net and MySQL db. When I insert cyrillic values into db, they are inserted as ‘?’ symbols. I have tried various encodings in db, this didn`t help. I tried utf-8, utf-16, cp-1251 and many others.
So when I execute this code
MySql.Data.MySqlClient.MySqlConnection con = new MySql.Data.MySqlClient.MySqlConnection("server=localhost;User Id=root;database=voteme");
MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand("INSERT INTO districts(DistrictName) VALUES('іавп')",con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
I receive ‘????’ stored in my db. How do I solve this problem?
Thanks.
Edit: I tried to use both varchar and text field types in database: result was still the same.
Be sure to use UTF8 as database collation.
Try this immediately after opening connection: