Bug #107319 | I can't import csv file to table because Unhandled exception: 'charmap' | ||
---|---|---|---|
Submitted: | 17 May 2022 17:50 | Modified: | 18 May 2022 11:52 |
Reporter: | freddy Alc | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Workbench | Severity: | S2 (Serious) |
Version: | 8.0.29 | OS: | Windows (x64 bits) |
Assigned to: | CPU Architecture: | x86 (Intel core i5) |
[17 May 2022 17:50]
freddy Alc
[17 May 2022 18:07]
freddy Alc
I forgot add this log, from C:\Users\freddydev\AppData\Roaming\MySQL\Workbench\log Here is the content of the log file: File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\Python\Lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 7799: character maps to <undefined> 12:47:11 [INF][ WQE.net]: Shutting down SQL editor (localhost) 12:47:12 [INF][ Workbench]: Shutting down Workbench 12:47:12 [INF][ mforms managed]: Shutting down mforms wrapper 12:47:12 [INF][ Workbench]: Done
[18 May 2022 11:14]
MySQL Verification Team
Hello freddy, Thank you for the bug report. I tried to reproduce your issue on windows 10 with MySQL Workbench 8.0.29 and imported csv utf8 file without any issues. Could you please provide a sample csv file which is causing this issue? Regards, Ashwini Patil
[18 May 2022 11:50]
freddy Alc
Maybe the problem happens because the file is 4.5 GB
[18 May 2022 12:45]
MySQL Verification Team
Successfully imported a csv file
Attachment: 107319_test_results.PNG (image/png, text), 52.39 KiB.
[4 Nov 2024 12:25]
Ankit raj
not able to import csv file with larger row
[25 Feb 12:43]
Pedro Prieto Martin
In the stackoverflow question they explain the issue, and propose a workaround. I was affected by the problem (in a Mac, my encoding was forced to ASCII despite specifying it should be UTF8) and the workaround worked for me: https://stackoverflow.com/questions/71992180/mysql-error-unhandled-exception-ascii-codec-c... Mysql Workbench 8.0.29+ has bug on "Table Data Import" feature. Reference: https://www.youtube.com/watch?v=F773id46dXI https://bugs.mysql.com/bug.php?id=107319 Mysql Workbench only apply the first option in encoding list, even though you select a other encoding (utf8, ...etc). If the first option can't decode your csv file, Mysql Workbench will throw exception then break. In my situation, my first option is 'cp950' and my CSV file is utf-8. Mysql Workbench throw exception and break. Even though I changed encoding to utf-8, Mysql Workbench still throw a 'cp950' exception. I can't convert my CSV to ASCII or CP950, because my data not only ASCII / CP950 characters. A workaround: - Exit Mysql Workbench - Open folder C:\Program Files\MySQL\MySQL Workbench 8.0 CE\python\lib\encodings - Backup the first option encoding python files in your list. (In my situation first option is cp950.py and cp950.pyc) - Copy utf_8.py, utf_8.pyc and rename to cp950.py, cp950.pyc. - Override original cp950.py, cp950.pyc in folder. - Launches Mysql Workbench and Import again.