rfc:kill-csv-escaping

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
rfc:kill-csv-escaping [2018/09/27 10:26] – created cmbrfc:kill-csv-escaping [2018/09/27 14:32] – Add link to mentioned bug report cmb
Line 9: Line 9:
 ===== 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.
Line 69: Line 69:
 ===== 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.
rfc/kill-csv-escaping.txt · Last modified: 2018/12/02 15:19 by cmb