MySqlConnectionStringBuilder CharacterSet Property
Posted by: Ben Hagley
Date: July 31, 2025 09:24AM

Hi

I have a ASP.Net core web app hosted in Azure connected to a Azure MySQL Flexible Server. The web app is utilising MySql.EntityFrameworkCore (8.0.14).

The MySQL connection string is built using MySqlConnectionStringBuilder.

When updating or adding EF Core entities that contain unicode characters (for our Translations data), the rows in the MySQL table contain question marks instead of the unicode data.

I have found the MySqlConnectionStringBuilder property CharacterSet. The documentation says the following for this property....

Supported for backwards compatibility; MySqlConnector always uses utf8mb4

When I do not set this property, I get the question marks in the database, but when specifically setting it to "utf8mb4" the data is created correctly.

I have two questions....
1) Why do I need to set the CharacterSet to "utf8mb4" if it should be the default?
2) Is there anyway I can determine in code what the CharacterSet is when I do not set the property. (When checking the property on MySqlConnectionStringBuilder in debug it is a blank string)


Thanks

Options: ReplyQuote


Subject
Written By
Posted
MySqlConnectionStringBuilder CharacterSet Property
July 31, 2025 09:24AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.