0

I want to create mysql database backup using c#. But this code do some problem because in my database i used "latin1_swedish_ci" thats why after export localize data convert into this form "مرسلی".

try
            {
                string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

                using (MySqlConnection conn = new MySqlConnection(con))
                {
                    using (MySqlCommand cmd = new MySqlCommand())
                    {
                        using (MySqlBackup mb = new MySqlBackup(cmd))
                        {
                            cmd.Connection = conn;
                            conn.Open();
                            mb.ExportToFile(path + "\\backup.sql");
                            conn.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
  • 2
    Possible duplicate of [Convert Latin 1 encoded UTF8 to Unicode](https://stackoverflow.com/questions/1430513/convert-latin-1-encoded-utf8-to-unicode) – Tim Apr 28 '19 at 14:54
  • Try add a connection string option "charset=utf8", for example: server=localhost;user=root;pwd=test;database=test;charset=utf8; – mjb Jul 25 '19 at 11:25

0 Answers0