Bug #30568 Invalid charset gets selected when looking at ODBC configuration
Submitted: 22 Aug 2007 15:45 Modified: 13 Sep 2007 17:28
Reporter: Stefan Nordhausen Email Updates:
Status: Closed Impact on me:
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.19 OS:Windows (XP SP2)
Assigned to: Jim Winstead CPU Architecture:Any

[22 Aug 2007 15:45] Stefan Nordhausen
When one opens the "ODBC Data Source Administrator" in Windows and selects "Configure" it is extremely easy to select an invalid charset without noticing it.

This causes problems when connecting from VBA (Visual Basic for Applications), even though the connection check in the ODBC Administrator still works. The error message I get when trying to open a connection via VBA is

"Can't initialize character set  (path: C:\mysql\\share\charsets)"

Note the extra space in the error message!

How to repeat:
- Configure a MySQL connection with the ODBC Data Source Administrator
- Select the "Connect Options" tab
- Open the "Character Set" combo-box to see the list of possible character sets
- Click outside the list or press ESC to NOT select anything  ***
- Close the window by pressing OK

Now, a new registry key HKEY_CURRENT_USER/Software/ODBC/ODBC.INI/<connection_name>/CHARSET gets created. The value of the key is " " (one space). Deleting the key or setting its value to "" resolves the issue.

*** This is what you expect. However, the GUI thinks you selected " ".

Suggested fix:
The configuration GUI should correctly detect that I did not want to select a certain character set and just do nothing.

Also, the connection check should use the character set that is configured so that one can detect the error. Otherwise, people will think ODBC is correctly configured and the problem is in their application. The connection check could warn the user if the configured character set is unknown (also useful if the character set was set manually in the registry).
[22 Aug 2007 16:17] MySQL Verification Team
Thank you for the bug report.
[5 Sep 2007 8:40] Stefan Nordhausen
The same thing happens with the combo box that lets you select the database to connect to, which makes it easy to accidently delete your database selection. So this seems to be a general problem with the handling of combo boxes and may affect other parts of the GUI as well.
[11 Sep 2007 1:00] Jim Winstead
Use empty string instead of one space for empty selection in combo boxes

Attachment: bug30568.patch (text/plain), 1008 bytes.

[11 Sep 2007 5:18] Jim Winstead
The fix for this bug has been committed to the source repository. It will be included in the next release, 3.51.21.
[13 Sep 2007 17:28] MC Brown
A note has been added to the 3.51.21 changelog: 

Clicking outside the character set selection box when configuring a new DSN could cause the wrong character set to be selected.