Bug #103332 Can't open configuration file due to UnicodeDecodeError
Submitted: 15 Apr 12:55 Modified: 8 Sep 12:34
Reporter: Henning Schmidt Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:8.0 OS:Microsoft Windows
Assigned to: CPU Architecture:x86
Tags: my.ini, unicodeDecodeError

[15 Apr 12:55] Henning Schmidt
Description:
I installed mysql 8.0 on a fresh Win Server 2019. After installation I'm not able to open the Servers Option File (my.ini).

Error: Error opening configuration file. UnicodeDecodeError: 'charmap' codec can't be decoded byte 0x9d in position 4292: character maps to <undefined>. 

I have never touched the my.ini in any way.

How to repeat:
German Windows Server 2019. Fresh Install.
[15 Apr 13:03] Henning Schmidt
Added information: I opened the configuration file with the workbench (Version 8.0 CE)
[15 Apr 13:52] MySQL Verification Team
Check last comment from https://bugs.mysql.com/bug.php?id=95293. Thanks.
[15 Apr 18:19] Henning Schmidt
That fixed my problem that I could not restart the service after editing the my.ini with the build-in Windows Editor (I saved the file as UNICODE, nevertheless it wasn't working after restarting, now used notepad++ and it's working fine). But I still can't access the option page in the workbench. 
Deinstalled the server, deleted all files, reinstalled mysql 8.0 -> Same error.
[19 Apr 13:21] MySQL Verification Team
Hello Henning Schmidt,

Thank you for the bug report and feedback.
This might be fixed in WB 8.0.24, hence wait until 8.0.24 is out and try again. Thanks.

Regards,
Ashwini Patil
[13 May 16:41] Lee Matthews
I have the same issue with MySQL Workbench 8.0.25.
UnicodeDecodeError: 'charmap' codec can't decode byte0x9d in position 4312: character maps to <undefined>
[20 May 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[7 Jun 14:40] Renee La Forest
If you have changed the default location, check the permissions on the newly created folder.
[8 Sep 9:04] Pieter Sadie
Just installed MySQL 8.0.25 on a new server
Immediately upgraded all components to 8.0.26 after install.

Tried to open Options File in Workbench but getting the error:
Cannot Open Configuration file
UnicodeDecode Error: 'charmap' codec can't decode byte 0x9d in position 4451: Character maps to <undefined>

Also, when trying to save the changes in the Options file, I get this error:
Error: Unhandled exception ('mysqld',)
[8 Sep 10:17] Pieter Sadie
After doing some research I found the following:

https://bugs.mysql.com/bug.php?id=103750

and also
https://stackoverflow.com/questions/63433111/how-to-fix-the-error-unicodedecodeerror-charm...

They all mentioned "weird characters" in the file being the cause of the Unicode Decode error.

Just as a test, I deleted the entire comment section above the "server-id=" parameter

I closed WorkBench and re-opened it, and now it is able to open the Options File. 

However I am still unable to save the changes. Workbench says it is unable to write to C:\ProgramData\MySQL\MySQL Server 8.0\my.ini. 

But I just previewed the file and copied the changes and then made the changes using NotePad++ in Admin mode and that worked.

Clearly there are indeed some "weird characters" in the My.ini file that needs to be removed.
[8 Sep 10:40] Pieter Sadie
I still kept getting the Unicode Decode error in WorkBench 8.0 version 26
I then noted the position of the character giving the error - for example 5724.

Using NotePad++ go to View, Show Symbol, Show All Symbols.
Then scroll down and find the character in that position (it shows the position of the cursor at the bottom).
In this case it turned out to be a CRLF character at that position.
I deleted it and pressed ENTER to create a new CRLF character and saved the file.
Closed Workbench and re-opened and it now opens the file again.

For Reference, I am using Windows 10 21H1 build 19043.1202
[8 Sep 12:34] MySQL Verification Team
Hello,

Thank you for the feedback.
Imho this is duplicate of Bug #104365, please see Bug #104365.

Regards,
Ashwini Patil
[20 Oct 22:49] ruud pols
I finally solved this issue by opening my.ini with notepad++ and converting the encoding from utf8 to ansi...  Weird.