| Bug #94735 | CSV export doesn't escape double quotes | ||
|---|---|---|---|
| Submitted: | 21 Mar 2019 14:01 | Modified: | 22 Mar 2019 9:56 |
| Reporter: | D H | Email Updates: | |
| Status: | Won't Fix | Impact on me: | |
| Category: | MySQL Workbench | Severity: | S3 (Non-critical) |
| Version: | 8.0.15 | OS: | Windows (Windows 10) |
| Assigned to: | CPU Architecture: | x86 (Intel i7-4790) | |
| Tags: | csv, export | ||
[22 Mar 2019 9:56]
MySQL Verification Team
Hello! Thank you for the report. regards, Umesh
[3 Oct 2024 15:51]
Matt Dyer
I ran into this issue also. I was able to get around it by manually escaping the quotes like this. SELECT Replace(MyColumnWithQuotes, '"', '""') AS MyColumnWithQuotes FROM Table
[25 Nov 2025 15:38]
Uke Proli
Apparently CSV export should work according to RFC
[14 Sep 18:04]
Omer Barnir
Posted by developer: This issue applies to the legacy MySQL Workbench 8.x implementation that is no longer supported or maintained. MySQL Workbench 26.7 is a complete rewrite using a new technology stack and does not use the affected legacy implementation. Therefore, this issue is not applicable to the current MySQL Workbench product and as such is closed.

Description: The CSV export functionality isn't properly escaping double quotes inside of values. This causes missing double quote characters and potentially incorrect column splitting if a comma is included in the value. How to repeat: CREATE SCHEMA `test` ; CREATE TABLE `test`.`test` ( `test_id` INT NOT NULL AUTO_INCREMENT, `description` VARCHAR(45) NOT NULL, PRIMARY KEY (`test_id`)); INSERT INTO `test`.`test` (`description`) VALUES ('This record has \'single quotes\''); INSERT INTO `test`.`test` (`description`) VALUES ('This record has \"double quotes\"'); INSERT INTO `test`.`test` (`description`) VALUES ('This record has \"double quotes\" and, a comma'); INSERT INTO `test`.`test` (`description`) VALUES ('This, record, has, lots, of, commas'); INSERT INTO `test`.`test` (`description`) VALUES ('This record has \"a, comma\" in \"quotes\"'); Select all rows in table, export to CSV. Actual output: test_id,description 1,"This record has 'single quotes'" 2,"This record has "double quotes"" 3,"This record has "double quotes" and, a comma" 4,"This, record, has, lots, of, commas" 5,"This record has "a, comma" in "quotes"" Expected output: test_id,description 1,"This record has 'single quotes'" 2,"This record has ""double quotes""" 3,"This record has ""double quotes"" and, a comma" 4,"This, record, has, lots, of, commas" 5,"This record has ""a, comma"" in ""quotes""" Open this file in a CSV viewer and see that all previously mentioned issues are gone. Suggested fix: Conform to RFC 4180 2.7 "If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote." Properly escape double quotes by adding another double quote character before any double quote characters found in a field.