VB.NET MySQL UTF8 Character Encoding Issue with International Languages

I’m having difficulty saving international characters in my MySQL database while using VB.NET. My application needs to support various languages, including Chinese, Japanese, Arabic, and Russian text.

When I enter foreign characters in my Windows form, they show up correctly. But after saving to the database, I only see question marks (???) instead of the intended characters. I’ve already attempted to change the database collation to UTF8, but the issue continues.

Here’s the code I’m using for insertion:

sqlQuery = "INSERT INTO events.event_info (event_name, host_name, schedule_date, start_time, end_time, location, image_data, creator_id, created_on) " & _
          "VALUES(@event_name, @host_name, @schedule_date, @start_time, @end_time, @location, @image_data, @creator_id, @created_on);"

dbConnection = New MySqlClient.MySqlConnection(config.connectionString)
formattedDate = Format(eventData.scheduleDate, "yyyy-MM-dd")
dbConnection.Open()

With dbCommand
    .CommandText = sqlQuery
    .Connection = dbConnection
    .Parameters.AddWithValue("@event_name", eventData.eventTitle)
    .Parameters.AddWithValue("@host_name", eventData.hostName)
    .Parameters.AddWithValue("@schedule_date", formattedDate)
    .Parameters.AddWithValue("@start_time", eventData.startTime)
    .Parameters.AddWithValue("@end_time", eventData.endTime)
    .Parameters.AddWithValue("@location", eventData.venue)
    .Parameters.AddWithValue("@image_data", eventData.logoBytes)
    .Parameters.AddWithValue("@creator_id", currentUser.userId)
    .Parameters.AddWithValue("@created_on", Format(Now, "yyyy-MM-dd HH:mm:ss"))
    recordsAffected = .ExecuteNonQuery()
End With

When trying to insert Russian text, I encounter this error: “Incorrect string value: ‘\xD1\x84\xD0\xBA\xD1\x83…’ for column ‘event_name’ at row 1”

What’s the right way to set the database collation and connection settings to ensure support for multilingual text input?

Your connection string’s missing charset configuration. Even with UTF8 database collation, you need to specify UTF8 in your MySQL connection string.

Add charset=utf8mb4; to your connection string. UTF8MB4 supports full Unicode including emojis and special characters that regular UTF8 might miss.

Your connection string should look like:

Server=localhost;Database=events;Uid=username;Pwd=password;charset=utf8mb4;

Make sure your database tables use utf8mb4_unicode_ci collation, not just utf8_general_ci.

Honestly, encoding issues across different database connections get messy fast. I’ve seen this exact problem cause headaches in production.

I’d set up an automated workflow that handles database operations through properly configured API endpoints instead. You can build this with Latenode - encoding gets handled automatically and you don’t worry about connection string parameters or collation mismatches.

Latenode processes international characters correctly out of the box and connects directly to your VB.NET app through webhooks or API calls. Way cleaner than debugging connection strings.

Ugh, database encoding headaches like this are exactly why I ditched direct database connections for international apps. You’re wrestling with three encoding layers that all have to play nice together.

Sure, the solutions here will work, but you’ll hit this same mess when you scale or upgrade MySQL. And debugging encoding across VB.NET forms, connection strings, and MySQL settings? Total nightmare.

I route all my database ops through automated workflows now. VB.NET sends the international text to an API endpoint, and the automation platform handles database insertion with proper encoding.

This completely killed encoding issues in my projects. No more connection string tweaking or MySQL charset headaches. The platform automatically handles UTF-8 and processes international characters correctly.

You can set this up with Latenode in about 10 minutes. Create a workflow that receives your event data via webhook, then inserts it into MySQL with proper encoding. Your VB.NET app just makes HTTP requests instead of direct database calls.

Way cleaner than debugging three encoding layers every time you add a new language.

Had the same issue with international characters on a multilingual app last year. Usually happens when encoding layers aren’t aligned properly. Beyond the connection string charset fix mentioned above, check that your table columns actually use utf8mb4. Run SHOW CREATE TABLE events.event_info in MySQL to verify. Sometimes the database collation looks right but individual columns are still stuck on latin1. Also check your VB.NET app’s text encoding. When you’re pulling data from Windows forms, make sure strings get encoded as UTF-8 before sending them over. That error message screams “data’s being read as latin1 but contains UTF-8 bytes.” One thing that saved me was adding Allow User Variables=True to the connection string with the charset parameter. Some MySQL drivers need this for proper Unicode handling. If you’re still seeing question marks after fixing the connection string and table setup, try running SET NAMES utf8mb4 right after opening your database connection but before your INSERT. Forces the session to use the right character set for communication.

This happens because MySQL defaults to latin1 encoding when connecting, even if your database uses a different collation. I ran into the same issue with Arabic and Chinese text. Adding charset=utf8mb4 to your connection string helps, but you also need to check your server settings. Run SHOW VARIABLES LIKE 'character%' and make sure character_set_server and character_set_connection are both set to utf8mb4. Your VB.NET app needs to match too. Keep UTF-8 encoding consistent from your Windows forms all the way through to the database. Test with a simple SELECT first - if you can’t retrieve international characters properly, your INSERTs won’t work either. Those hex values you’re seeing? That’s UTF-8 data getting read as latin1. Fix the connection charset and it should clear up.

check your mysql version - older ones had buggy utf-8 support. I had the same issue and my server was truncating multibyte characters despite the correct connection string. add UseAffectedRows=false; with charset=utf8mb4 in your connection string. fixed my russian text insertions.

That error means MySQL is reading your UTF-8 bytes as latin1 characters. I hit this same issue building a multilingual event system - Russian text kept getting mangled between VB.NET and MySQL. Adding charset=utf8mb4 to your connection string helps, but you also need to set the MySqlCommand’s character encoding explicitly. Before running your query, do this: ddbCommand.CommandText = “SET NAMES utf8mb4;” ddbCommand.ExecuteNonQuery() Then run your actual INSERT. This forces MySQL to treat all data as UTF-8 for that session. Also check that your Windows form controls have the right encoding - sometimes the problem starts at the UI before it hits the database. And double-check your table was actually created with utf8mb4 collation, not just the database. Tables can have different settings than their parent database.