Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 35290 invoked from network); 7 Oct 2008 14:24:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Oct 2008 14:24:07 -0000 Received: (qmail 31852 invoked by uid 500); 7 Oct 2008 14:24:04 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 31778 invoked by uid 500); 7 Oct 2008 14:24:04 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 31761 invoked by uid 99); 7 Oct 2008 14:24:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Oct 2008 07:24:04 -0700 X-ASF-Spam-Status: No, hits=-1999.9 required=10.0 tests=ALL_TRUSTED,DNS_FROM_SECURITYSAGE X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Oct 2008 14:23:09 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 02040234C21C for ; Tue, 7 Oct 2008 07:23:45 -0700 (PDT) Message-ID: <165868723.1223389425007.JavaMail.jira@brutus> Date: Tue, 7 Oct 2008 07:23:45 -0700 (PDT) From: "Sebb (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (SANDBOX-263) Excel strategy uses wrong seperator In-Reply-To: <440323834.1223379224430.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/SANDBOX-263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sebb updated SANDBOX-263: ------------------------- Summary: Excel strategy uses wrong seperator (was: Excel sategy uses wrong seperator) > Excel strategy uses wrong seperator > ----------------------------------- > > Key: SANDBOX-263 > URL: https://issues.apache.org/jira/browse/SANDBOX-263 > Project: Commons Sandbox > Issue Type: Bug > Components: CSV > Reporter: Gunnar Wagenknecht > > The Excel strategy is defined as follows. > {code} > public static CSVStrategy EXCEL_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, false, > false, false, false); > {code} > However, when I do a "Save as" in Excel the separator used is actually {{';'}}. Thus, parsing the CSV file as suggested in the JavaDoc of {{CSVParser}} fails. > {code} > String[][] data = > (new CSVParser(new StringReader("a;b\nc;d"), CSVStrategy.EXCEL_STRATEGY)).getAllValues(); > {code} > Simple test to reproduce: > {code} > import java.io.IOException; > import java.io.StringReader; > import org.apache.commons.csv.CSVParser; > import org.apache.commons.csv.CSVStrategy; > public class CSVExcelStrategyBug { > public static void main(final String[] args) { > try { > System.out.println("Using ;"); > parse("a;b\nc;d"); > System.out.println(); > System.out.println("Using ,"); > parse("a,b\nc,d"); > } catch (final IOException e) { > e.printStackTrace(); > } > } > private static void parse(final String input) throws IOException { > final String[][] data = (new CSVParser(new StringReader(input), CSVStrategy.EXCEL_STRATEGY)).getAllValues(); > for (final String[] row : data) { > System.out.print("["); > for (final String cell : row) { > System.out.print("(" + cell + ")"); > } > System.out.println("]"); > } > } > } > {code} > Actual output: > {noformat} > Using ; > [(a;b)] > [(c;d)] > Using , > [(a)(b)] > [(c)(d)] > {noformat} > Expected output: > {noformat} > Using ; > [(a)(b)] > [(c)(d)] > Using , > [(a,b)] > [(c,d)] > {noformat} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.