Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79002 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54191 invoked from network); 19 Nov 2014 16:26:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2014 16:26:49 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.15.19 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.15.19 mout.gmx.net Received: from [212.227.15.19] ([212.227.15.19:59567] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/40-51809-5C4CC645 for ; Wed, 19 Nov 2014 11:26:46 -0500 Received: from [192.168.0.100] ([91.67.244.80]) by mail.gmx.com (mrgmx001) with ESMTPA (Nemesis) id 0LnxxQ-1YSPmr3c8e-00g36d; Wed, 19 Nov 2014 17:26:41 +0100 Message-ID: <546CC4C8.7010001@gmx.de> Date: Wed, 19 Nov 2014 17:26:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Tjerk Meesters , PHP Internals References: <82139FDD-8D8B-43D9-B811-ECC1FFE6E8A6@gmail.com> In-Reply-To: <82139FDD-8D8B-43D9-B811-ECC1FFE6E8A6@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:BqpfRYzqUWdvy7S8KmuAI1Xtq8g6y9CRXz5F5Pq2nJpyOoFn9Fn RXUM36xcy1oZy8M0YHpo+kS8943lCqAJfYaMpCaU6+i/pfRWJKUf4ViD7uOPH1c7prHFNR7 m7n37RFLX3CwValZKZZS+MyCLc3rPYC2q34beoJfu7FTOE7cgilOvbKnbqhYPAHL1JIBwjQ lRAB6srG090dHkVFBcTjA== X-UI-Out-Filterresults: notjunk:1; Subject: Re: fgetcsv incompatible with fputcsv From: cmbecker69@gmx.de (Christoph Becker) Tjerk Meesters wrote: > Hi list, > > As I was fiddling with CSV data reading and writing I noticed that fgetcsv() is inherently incompatible with fputcsv() when it comes to the enclosure escape character that’s used. > > Example: http://3v4l.org/LHEZj > > The above example code demonstrates how, by default, fputcsv() encodes a backslash as is but fgetcsv() will treat that same backslash as the enclosure escape character as well as the enclosure character itself; this is rather surprising behaviour and imho unnecessarily complicated. > > I would suggest changing the behaviour in such a way that: > a) the default enclosure escape character for fgetcsv() is a double quote. > b) fgetcsv() only treats the escape character as … an escape character. > > Due to the kind of change BC can’t be maintained, so I’d propose this change for PHP 7. > > If anyone has violent objections to the above, or thinks that an RFC should be drawn up, do let me know … otherwise I’ll commit the change into master by next week or so. Are you aware of ? It seems this very inconsistency has been reported a few years ago, but has been tagged as "Wont fix" back then. also seems to deal with this inconsistency, and had been tagged as "Not a bug". So maybe an RFC is appropriate? -- Christoph M. Becker