-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unicode special characters causing 'Incorrect String value' errors (MySQL) #27
Comments
Running the following will reliably reproduce this crash static void DB(MySqlConnection c) {
string s = "INSERT INTO " + tbl + " SET title = @title, result_data = @data, run_on = @when";
// Adding or removing this block will reproduce the error
var set = c.CreateCommand();
set.CommandText = "set names utf8mb4"; // or simply utf8
set.ExecuteNonQuery();
var cmd = c.CreateCommand();
cmd.CommandText = s;
cmd.Parameters.AddWithValue("title", title);
cmd.Parameters.AddWithValue("data", data); // contains 'Ç'
cmd.Parameters.AddWithValue("when", run_on);
cmd.ExecuteNonQuery();
Console.WriteLine("DB DONE");
Console.Read();
} Need to investigate why |
This is due to the It seems not to set everything correctly, whereas adding: Workaround is to include the charset in the connection string |
The following string threw on

.Store()
Data came from a table in utf8 and was being stored to a table of utf8mb4
The text was updated successfully, but these errors were encountered: