Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78990 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25136 invoked from network); 19 Nov 2014 12:24:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2014 12:24:06 -0000 Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.171 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.192.171 mail-pd0-f171.google.com Received: from [209.85.192.171] ([209.85.192.171:35804] helo=mail-pd0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/81-15892-5EB8C645 for ; Wed, 19 Nov 2014 07:24:06 -0500 Received: by mail-pd0-f171.google.com with SMTP id v10so572678pde.16 for ; Wed, 19 Nov 2014 04:24:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=i9A9ry5rI41rirRZN8kyrDzs+/EH9lG+Wvu/xSNG0AM=; b=i2Q44fvyJAjZ815t0KhfblTRNieekxjX2RJ9M6oI16j3VGq5jU3Lr9b4fpQGsHuhSp WphmAwjCVVeVfv7GrCzOXIZ1rMTdF2y0126Acg3CvUkzF9F3jFaQkeVVwsrZiBS5N3jh Dk30hYarByLo9vnOhl/FeNXQBA8kMTzJdqBt/L6HgFx074tJHHdjogbWfKVUsZY4m0yk QRtSRR/yvr/UcQON1ClJy3sp1ad2+YDYAhUvg/NN5Xmc/W7HRnGOIXJZeYufAOpU/azB ceBFH0AQumUwnoZ/7hMooBg9Tx3Esa/cj0snMM9kh8d7uCofMiMg3UVjuPec/wLo5lNl RGDQ== X-Received: by 10.66.236.163 with SMTP id uv3mr19955515pac.136.1416399842691; Wed, 19 Nov 2014 04:24:02 -0800 (PST) Received: from unknown_0c-4d-e9-aa-30-37.gateway.2wire.net (bb121-7-198-24.singnet.com.sg. [121.7.198.24]) by mx.google.com with ESMTPSA id bv3sm1715720pdb.32.2014.11.19.04.24.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Nov 2014 04:24:01 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <82139FDD-8D8B-43D9-B811-ECC1FFE6E8A6@gmail.com> Date: Wed, 19 Nov 2014 20:20:01 +0800 To: PHP Internals Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) X-Mailer: Apple Mail (2.1990.1) Subject: Re: fgetcsv incompatible with fputcsv From: tjerk.meesters@gmail.com (Tjerk Meesters) 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=E2=80=99s 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 =E2=80=A6 an escape = character. Due to the kind of change BC can=E2=80=99t be maintained, so I=E2=80=99d = 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 =E2=80=A6 otherwise I=E2=80=99ll = commit the change into master by next week or so. Best, Tjerk=