Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78989 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23567 invoked from network); 19 Nov 2014 12:21:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2014 12:21:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.170 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.192.170 mail-pd0-f170.google.com Received: from [209.85.192.170] ([209.85.192.170:46200] helo=mail-pd0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D9/21-15892-26B8C645 for ; Wed, 19 Nov 2014 07:21:54 -0500 Received: by mail-pd0-f170.google.com with SMTP id fp1so567946pdb.15 for ; Wed, 19 Nov 2014 04:21:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:date :content-transfer-encoding:message-id:to; bh=h1zQA3SCYnzv76JLUyXblGFE/4gmCSz2WgnhU8VJ8oo=; b=OPVy9a/KfJb0PBtSJ0VLLWWe/XtfpcNR6RthS0uVlvCdla0OFRgD/4pfB82daqWo4+ 6EylfMS3QjZUfHsE4iHjDFxFPMPX4xg7Qswbqp940/UAyThSNWId4HSSijwRWcCzBGBR Iwssy5HnFMdlnhHaQHhNY/sbQpav4uzwhOap1ibSt6b5teV9U9MrxjUcbFaLIXNBqQPz Otv/nvvTtUlgeVhWqa4RDSkevxePiKh8MOdcAxopXEcpTjetCD1SBAQueoO5GIM2INn4 hpsJ3AItopa2ccB6jSWuyNDGTQ8qBtPST2EDbhsjRbNoem7YB9AnEdg5nDlc2Wi43OH3 YL6g== X-Received: by 10.70.3.196 with SMTP id e4mr40601741pde.35.1416399710851; Wed, 19 Nov 2014 04:21:50 -0800 (PST) Received: from [192.168.1.42] (bb121-7-198-24.singnet.com.sg. [121.7.198.24]) by mx.google.com with ESMTPSA id im5sm1792863pbb.43.2014.11.19.04.21.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Nov 2014 04:21:49 -0800 (PST) Content-Type: text/plain; charset=gb2312 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) X-Apple-Base-Url: x-msg://10/ X-Universally-Unique-Identifier: A1B5D612-D98F-48B6-A2A0-6FB8FFCE3CDC X-Apple-Mail-Remote-Attachments: YES X-Mailer: iPhone Mail (12B436) X-Apple-Windows-Friendly: 1 Date: Wed, 19 Nov 2014 20:21:46 +0800 Content-Transfer-Encoding: quoted-printable X-Smtp-Server: smtp.gmail.com:tjerk.meesters Message-ID: <19DC493D-898A-4496-BA9B-E35563D53D8E@gmail.com> X-Uniform-Type-Identifier: com.apple.mail-draft To: PHP Internals 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 es= cape character that=A1=AFs used. Example: http://3v4l.org/LHEZj The above example code demonstrates how, by default, fputcsv() encodes a bac= kslash as is but fgetcsv() will treat that same backslash as the enclosure e= scape character as well as the enclosure character itself; this is rather su= rprising 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 =A1=AD an escape character.= Due to the kind of change BC can=A1=AFt be maintained, so I=A1=AFd propose t= his change for PHP 7. If anyone has violent objections to the above, or thinks that an RFC should b= e drawn up, do let me know =A1=AD otherwise I=A1=AFll commit the change into= master by next week or so. Best, Tjerk=