-
Notifications
You must be signed in to change notification settings - Fork 7.9k
fputcsv incorrectly escapes when quote char is both enclosure and escape char #18348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
https://3v4l.org/pshQW reproducible |
Apparently, when both enclosure and escape characters are present, this can lead to unintended behavior.
I'll think about how to fix it |
Ah, no.
https://www.php.net/manual/en/function.fgetcsv.php This appears to be the intended behavior. |
As usual with anything CSV related I plug in my ext/csv extension which solves these issues as it is conformant to RFC 4180: https://packagist.org/packages/girgias/csv |
No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you. |
Description
The following code:
Resulted in this output:
But I expected this output instead:
In the expected output it should be the quote chars doubled and whole second cell should be by quote chars enclosed. Expected output will be then properly read by Excel (we use Czech, so semicolon used as col separator)
PHP Version
PHP Version 8.4.6
Windows NT ___ 10.0 build 22631 (Windows 11) AMD64
Operating System
Windows
The text was updated successfully, but these errors were encountered: