Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100758 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53758 invoked from network); 22 Sep 2017 18:39:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Sep 2017 18:39:47 -0000 Authentication-Results: pb1.pair.com header.from=andreas@dqxtech.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=andreas@dqxtech.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain dqxtech.net from 209.85.215.48 cause and error) X-PHP-List-Original-Sender: andreas@dqxtech.net X-Host-Fingerprint: 209.85.215.48 mail-lf0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:52391] helo=mail-lf0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FA/0F-62331-0F855C95 for ; Fri, 22 Sep 2017 14:39:45 -0400 Received: by mail-lf0-f48.google.com with SMTP id b127so1931531lfe.9 for ; Fri, 22 Sep 2017 11:39:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NtiS0TY5CExCg/l46ofnANuGYeB5h6papOr2Dst580Q=; b=V+KelK1HZBfHfaCEHuWWKbVtAVgLEEC0NACYwZE7BEknYTM8sGDtXxRhm0G03cw1Tj DR77OOVv1m2Mb4ySGThBbRPIABKQp5RwtV5NFF0xuQk9zIAhfvt6ljDtA8xZ05hI9Ufq GLGv3+ptBdLBO8vWgr2A7eSmIH8XVsvH5cocwxQl8UtGM+uLStrdOYYnt7Q9NDQQ18lN sYR6MFEAzwH9a5dTGlvqosIGT419xubQ3NegcYJWscoxLwvWxosdVSMRJ9iXp9fCkNi1 KK32ppLO7Pvrkn10wVE4QZioolrNiU6X+yoqyrXQYZ/7cr0r24b3okpKEfGn0fkz5Nn5 +VhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NtiS0TY5CExCg/l46ofnANuGYeB5h6papOr2Dst580Q=; b=HAjMMTFJMvUodVBk22aJ9hZHM4BV2MXZ/FaVCVnvLZ9Cf9l241itekEsu4gkioYZuq n0sTze9pJfhL4mk6fYZAURLIXn+uzKv04ZxCqZhTk1ZPayuuue2SWBwbpHCCJB8q6pTV zV+LztBjcnpI1TJcmEN3ofcdHNyTEH6qEnzylrlAV0QAcKYZUNPT4s3b1+EhJCghvgu9 TAMmavyOxpR9iBFoLd/IdG6OpjmsEuPjepUNO32hxI4iFW7+2pb6WLInJl390xT88bBh 27emrvU/5On6cvTkgXG9aRE9lgl8Y82mOYscYRW0FWrzGJbkv8V2Rwr5sM3CS89nBU54 1inA== X-Gm-Message-State: AHPjjUguQgs2Z7kuBBC+JfJla94CcRMWdABh1YVRlYbFMihb/57WK4P0 shehFyj7g5JuHi1ybasOr9BIbuCu X-Received: by 10.46.85.1 with SMTP id j1mr26080ljb.137.1506105581726; Fri, 22 Sep 2017 11:39:41 -0700 (PDT) Received: from mail-lf0-f43.google.com (mail-lf0-f43.google.com. [209.85.215.43]) by smtp.googlemail.com with ESMTPSA id s7sm49765lfg.28.2017.09.22.11.39.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 11:39:40 -0700 (PDT) Received: by mail-lf0-f43.google.com with SMTP id b127so1931457lfe.9 for ; Fri, 22 Sep 2017 11:39:40 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBXhGDKp1gWg8ibcX7t0YhyI6GWMaW+lrpgs8jEnvPXtD7ZZJtRZmaiE2pgEZ+JC4TwJaRKNCwgDqCExBLkgjU= X-Received: by 10.25.142.215 with SMTP id a84mr28559lfl.25.1506105579966; Fri, 22 Sep 2017 11:39:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.212.79 with HTTP; Fri, 22 Sep 2017 11:39:18 -0700 (PDT) In-Reply-To: <2e92a618-c053-0434-bbf4-511892d41758@gmx.de> References: <7cf5adb8-0738-259e-6d1e-f966722fdae2@gmx.de> <2e92a618-c053-0434-bbf4-511892d41758@gmx.de> Date: Fri, 22 Sep 2017 20:39:18 +0200 X-Gmail-Original-Message-ID: Message-ID: To: "Christoph M. Becker" Cc: Rowan Collins , PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] fputcsv() and $escape character From: andreas@dqxtech.net (Andreas Hennings) On Fri, Sep 22, 2017 at 1:20 PM, Christoph M. Becker wrote: >> please make sure the behaviour of common applications, most notably >> Excel, is considered and tested. In my experience it has its own quirks, >> and it's likely that a large proportion of users require >> interoperability with it. It may be there's nothing relevant to >> consider, but I thought I'd mention it, in case people get too caught up >> with a specification that nobody actually follows. > > That's exactly the point of this proposal. As it is, fputcsv() outputs > CSV that won't be understood by Excel (or any other CSV aware > implementation I'm aware of), as soon as the escape character is > actually part of any string. So being able to avoid any such escaping > would be helpful wrt. major CSV implementations, and making that the > default even more so. The other problem that this proposal wants to fix is that CSV cannot currently be used reliably to store or transport data between different PHP scripts, due to this bug: https://bugs.php.net/bug.php?id=74713&edit=2 > If one cell of the data sent to fputcsv() contains "{$enclosure}{$escape_char}{$escape_char}{$enclosure}{$delimiter}", this cell will be split after a round trip of fputcsv() + fgetcsv(). > > The only other issue that I can see is that currently our fputcsv() > hard-codes the line endings to LF (while RFC 4180 demands CRLF), but > that may not be a real problem anymore. (Well, there might be issues > with non ASCII compatible character encodings as well). I have opened a lot of php-generated CSV files with LibreOffice Calc, and the line endings have not been a problem. I assume Excel and OpenOffice would also be ok with it. I'd say stick with existing behavior for BC reasons, or discuss it separately.