Next revision | Previous revision |
rfc:kill-csv-escaping [2018/09/27 10:26] – created cmb | rfc:kill-csv-escaping [2018/12/02 15:19] (current) – Withdraw RFC cmb |
---|
* Date: 2018-09-27 | * Date: 2018-09-27 |
* Author: Christoph M. Becker, <cmb@php.net> | * Author: Christoph M. Becker, <cmb@php.net> |
* Status: Under Discussion | * Status: Withdrawn |
* First Published at: http://wiki.php.net/rfc/kill-csv-escaping | * First Published at: http://wiki.php.net/rfc/kill-csv-escaping |
| |
===== Introduction ===== | ===== Introduction ===== |
| |
For many years, we receive bug reports regarding the strange behavior of the $escape parameter of our CSV writing and reading functions (''fputcsv'', ''fgetcsv'' etc.); the latest has been reported today. Apparently, this escaping mechanism causes more harm than good. | For many years, we receive bug reports regarding the strange behavior of the $escape parameter of our CSV writing and reading functions (''fputcsv'', ''fgetcsv'' etc.); the latest has been [[https://bugs.php.net/bug.php?id=76940|reported today]]. Apparently, this escaping mechanism causes more harm than good. |
| |
Albeit CSV is still a widespread data exchange format, it has never been officially standardized. There exists, however, the “informational” [[https://tools.ietf.org/html/rfc4180|RFC 4180]] which has no notion of escape characters, but rather defines ''escaped'' as strings enclosed in double-quotes where contained double-quotes have to be doubled. While this concept is supported by PHP's implementation (''$enclosure''), the ''$escape'' sometimes interferes, so that ''fgetcsv()'' may be unable to correctly parse externally generated CSV, and ''fputcsv()'' is sometimes generating non-compliant CSV. Even a rountrip ''(fgetcsv(fputcsv(…))'' may fail. | Albeit CSV is still a widespread data exchange format, it has never been officially standardized. There exists, however, the “informational” [[https://tools.ietf.org/html/rfc4180|RFC 4180]] which has no notion of escape characters, but rather defines ''escaped'' as strings enclosed in double-quotes where contained double-quotes have to be doubled. While this concept is supported by PHP's implementation (''$enclosure''), the ''$escape'' sometimes interferes, so that ''fgetcsv()'' may be unable to correctly parse externally generated CSV, and ''fputcsv()'' is sometimes generating non-compliant CSV. Even a rountrip ''(fgetcsv(fputcsv(…))'' may fail. |
===== References ===== | ===== References ===== |
| |
| * [[https://externals.io/message/103268|RFC discussion]] |
* [[https://externals.io/message/100729|former discussion]] started by the author. | * [[https://externals.io/message/100729|former discussion]] started by the author. |
* [[https://externals.io/message/78990|former discussion]] started by Tjerk. | * [[https://externals.io/message/78990|former discussion]] started by Tjerk. |