Bug #113715 Character set 'utf8mb3' is not supported by .Net Framework
Submitted: 22 Jan 2024 21:02 Modified: 26 Jan 2024 17:38
Reporter: Steve Namuth Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:8.3.0 OS:Windows (Version 10)
Assigned to: CPU Architecture:Any
Tags: MySql Connector .NET, Power BI

[22 Jan 2024 21:02] Steve Namuth
Description:
When refreshing our Microsoft Power BI Dataset we are getting the following error. "An error happened while reading data from the provider: Character set 'utf8mb3' is not supported by .Net Framework."

The dataset is using the MySQL-Net connector which can be found on your download page (https://dev.mysql.com/downloads/connector/net/).

How to repeat:
1. Install Connector/Net 8.3.0 onto Windows 10 computer. (https://dev.mysql.com/downloads/connector/net/) 
2. Install Power BI Desktop (Latest Version)(https://www.microsoft.com/en-us/download/details.aspx?id=58494?ocid=ORSEARCH_Bing). 
3. Open Power BI Desktop and click on Get Data.
4. Chose the MySQL Connector.
5. Connect to MySQL database that uses Character Set Name utf8mb3. Pick any table and load into Power BI Desktop. Click Close and Apply to Refresh dataset.

Suggested fix:
When researching this issue, everything points to rolling back the connector to version 8.0.28. After removing the 8.3.0 connector and installing the 8.0.28 connector, the error goes away. 

I think the bug may be in the CharSetMap.cs file on Github. When comparing version 8.0.28 (https://github.com/mysql/mysql-connector-net/blob/8.0.28/MySQL.Data/src/CharSetMap.cs) the _mapping section at the bottom of the file (line 158) shows "_mapping.Add("utf8mb3", new CharacterSet("utf-8", 3));" for utf8mb3. 

However, when looking at any version past 8.0.28 (including 8.3.0 (https://github.com/mysql/mysql-connector-net/blob/8.3.0/MySQL.Data/src/CharSetMap.cs)) line 158 shows "_mapping.Add("utf8mb3", _mapping["utf8"]);"
[23 Jan 2024 3:51] Bradley Grainger
Duplicate of bug #107259?
[24 Jan 2024 12:51] MySQL Verification Team
Hello Steve,

Thank you for the bug report.
I tried to reproduce your issue on windows 11 with Connector/NET 8.3.0 and followed exact steps but I am not seeing any issues at my end.

Also, please note that utf8mb3 character set is deprecated and you should expect it to be removed in a future MySQL release. Please use utf8mb4 instead. 
For more info, please see https://dev.mysql.com/doc/refman/8.3/en/charset-unicode-utf8mb3.html

Regards,
Ashwini Patil
[26 Jan 2024 17:34] Steve Namuth
Yes same bug. Sorry I didn’t see that one when I searched for one. However, I don’t think the last comment on that bug is the solution. I still think the issue is in that character set mapping file in your guy’s connector.
[26 Jan 2024 17:38] Steve Namuth
To repeat the error you need to follow those steps above and connect to a MySQL database that has collation set to utf8mb3. While I know utf8mb3 is deprecated, the connector should still be backwards compatible. Expecting everyone to just update their database collation isn’t an acceptable solution.