title: Inserting diacritic characters into MySQL database
body: <p>I have MySQL database with table <em>MySqlTable</em> which is encoded utf8_slovak_ci and I'd like to INSERT strings with diacritics chars(ľščťžýáí...) typical for slovak language via C# code.</p>
  
  <p>I'm using MySql.Data.MySqlClient namespace for allowing MySql objects.
  My C# method:</p>
  
  <pre><code>    public void Insert(string sqlQuery, params string[] strings) 
      {
          MySqlCommand command = new MySqlCommand(sqlQuery, connection);
  
          for (int i = 0; i &lt; strings.Length; i++)
          {
              command.Parameters.Add(new MySqlParameter("@str" + i, strings[i]));
          }
  
          try
          {
              connection.Open();
              command.ExecuteNonQuery();
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message, "Chyba!", MessageBoxButton.OK, MessageBoxImage.Error);
          }
          finally 
          {
              connection.Close();
          }
      }
  </code></pre>
  
  <p>Calling this method from program:</p>
  
  <pre><code>database.Insert(query, newEmployee.Name);
  </code></pre>
  
  <p>where query is</p>
  
  <pre><code>string query = @"INSERT INTO MySqlTable(name) " +
                          "VALUES(@str0)";
  </code></pre>
  
  <p>Where is the problem...
  When I try to insert some string icluding that special characters (f.e. <em>Anča</em>), it is saved like <em>Anca</em> in the database. But when I execute corresponding INSERT query via phpmyadmin, it is saved properly. Problem chars are just <em>ľčťďň</em> (saved like <em>lctdn</em>), other chars like <em>šžýáíéúäô</em> are saved OK.
  Anybody knows where could be a problem? Thank you</p>