Coder Social home page Coder Social logo

opencsv's People

Forkers

qwijiboo

opencsv's Issues

Downloading sources corresponding to a specific release

Hello!
Congratulations for the nice API-rewriting of the OpenCSV project! Your API is 
indeed more usable!

In case that you are still active in this project, I have two small suggestions.

Many times when developing applications with lots of libraries, there is a need 
to have access to the source code corresponding to a specific release. For 
example if I include in my app the googlecode-opencsv-2.4.jar, then I need also 
to save somewhere the googlecode-opencsv-2.4-sources.jar
(so if in the next years more versions are released, like 2.5 and 2.6, but I 
cannot or will not upgrade the version 2.4 that I am using, then other new 
developers will be able to see the source code for the specific version 2.4, 
not the latest sources that are currently in the googlecode Source hg)

So my two small suggestions are:
1) Please also include in the Downloads section a jar with the sources for 2.4 
(opencsv-2.4-sources.jar)
2) In case you don't want to keep all these versions available for download, 
then please create a RELEASE TAG in the mercurial repository for the commit of 
the 2.4 release, to be able to refer to it when downloading the sources.

Original issue reported on code.google.com by [email protected] on 10 Dec 2014 at 3:59

Malformed data in the CSV file. Or the data being written on the same line in the CSV.

What steps will reproduce the problem?
1. I am using the opencsv to write data to the CSV file from the database. I am 
using writer = new CSVWriter(new FileWriter ("filename"),',', 
CSVWriter.NO_QUOTE_CHARACTER). I am storing the results of the database into a 
results object. Then I am using this writer.writeAll(results, false); To write 
data to CSV.
2. But I am writing around 50000000 records into CSV at one run.  I am pulling 
in 3 column from the database in that query. 
3. But I do see some malformed data in that. Or the data is overwritten on the 
same line for the next line.

What is the expected output? What do you see instead?
Here is the expected output
12414, 31-DEC-2100 00:00:00, 21-OCT-2014 00:00:00 AM
12415, 31-DEC-2100 00:00:00, 21-OCT-2014 00:00:00 AM
12416, 31-DEC-2100 00:00:00, 21-OCT-2014 00:00:00 AM
12417, 31-DEC-2100 00:00:00, 21-OCT-2014 00:00:00 AM

But I am seeing this in the CSV file
12414, 31-DEC-2100 00:00:12415, 31-DEC-2100 00:00:00, 21-OCT-2014 00:00:00 AM
12416, 31-DEC-2100 00:00:00, 21-OCT-201412417, 31-DEC-2100 00:00:00, 
21-OCT-2014 00:00:00 AM
12419, 31-DEC-2100 00:00:00, 21-OCT-2014 00:00:00 AM
124217, 31-DEC-2100 00:00:00, 21-OCT-2014 00:00:00 AM

So here I do see the data gets written on the same line instead of new line. 
This is hapenning not for all but some of the cases where the data gets written 
on the same line

What version of the product are you using? On what operating system?
Windows, linux

Please provide any additional information below.

So If I have a small set of data from database that works fine with a large set 
of data thats the issue of the data being writtem on the same line of the CSV.

Original issue reported on code.google.com by [email protected] on 31 Oct 2014 at 6:16

Write quoted fields only when necessary

What steps will reproduce the problem?

1. Use quotes only when needed such as when embedded newline, separator or 
quotes.

Current: "a","b,b","c" // all quoted

Desired: a,"b,b",c  // only quotes when needed


Version 2.4

Original issue reported on code.google.com by [email protected] on 2 Dec 2013 at 8:54

How to write incrementally?

The code I can see in the docs & the wiki all show dummy examples where just a 
couple of rows are written to a file.  If I have a huge amount of data that I 
want to generate and write to, say, System.out, how would I best go about it?  
Can I just make a writer object and call a method to write each row?

Original issue reported on code.google.com by [email protected] on 9 Jul 2013 at 5:45

Inproper interpretation of Micosoft Excel CSV file

What steps will reproduce the problem?
1. Compile the example code given below.

What is the expected output? What do you see instead?
Expected Output
Field: [test1]
Field: [These are "embedded" quotes]
Field: ["The whole phrase is quoted"]
Field: [Hello, World!]
Field: [Testing "double" quotes is "fun"]
Field: [This contains a single " quote]
Field: [This,contains,commas]
Field: []
Field: [red, "blue, yellow", green]
Field: [test2]

Actual output
Field: [  test1]
Field: [These are "embedded" quotes"  ]
Field: [  ""The whole phrase is quoted""  ]
Field: [Hello, World!"  ]
Field: [Testing "double" quotes is "fun""  ]
Field: [This contains a single " quote"  ]
Field: [This,contains,commas"  ]
Field: [  ,  ]
Field: [red, "blue, yellow", green"  ]
Field: [  test2  ]


What version of the product are you using? On what operating system?
opencsv 2.4 on Windows Server 2008 R2

Please provide any additional information below.

Use the following code snippet and information to reproduce.

/* This is how Microsoft Excel handles the following text as a CSV file.

   Within the cells of the spreadsheet are the following:
   A1 = [test1]
   B1 = [These are "embedded" quotes]
   C1 = ["The whole phrase is quoted"]
   D1 = [Hello, World!]
   E1 = [Testing "double" quotes is "fun"]
   F1 = [This contains a single " quote]
   G1 = [This,contains,commas]
   H1 = [,]
   I1 = [red, "blue, yellow", green]
   G1 = [test2]

   Here is how Excel creates the CSV file:
   test1,"These are ""embedded"" quotes","""The whole phrase is quoted""","Hello, World!","Testing ""double"" quotes is ""fun""","This contains a single "" quote","This,contains,commas",",","red, ""blue, yellow"", green",test2
*/
// an extra 2 spaces have been manually added before/after each value
String testString =
    "  test1,  \"These are \"\"embedded\"\" quotes\"  ,  \"\"\"The whole phrase is quoted\"\"\"  ,  \"Hello, World!\"  ,  \"Testing \"\"double\"\" quotes is \"\"fun\"\"\"  ,  \"This contains a single \"\" quote\"  ,  \"This,contains,commas\"  ,  \",\"  ,  \"red, \"\"blue, yellow\"\", green\"  ,  test2  ";
list = delimitedToList(testString, ',');

try (CSVReader reader = new CSVReader(new StringReader(testString))) {
    String[] fields;
    while ((fields = reader.readNext()) != null) {
        for (String field : fields) {
            System.out.println(String.format("Field: [%s]", field));
        }
    }
}
catch (IOException e) {
    e.printStackTrace();
}

Original issue reported on code.google.com by [email protected] on 18 Feb 2013 at 7:52

Append File

Hello,
How can I append a existed CSV file?

Original issue reported on code.google.com by [email protected] on 14 Jan 2015 at 11:58

A blank string "" is misinterpreted, when it occurs at the beginning of a line

When a CSV file contains an empty string "" as the first data item in a row, 
the CSVReader will read the character '"'. When the same string occurs as the 
second data item in a row, the CSVReader will read the empty String.

The problem has nothing to do with the file system, since it also occurs, when 
the input comes from a StringReader.

What steps will reproduce the problem?
--------------------------------------
1. Modify the attached JUnit test so that it finds the attached CSV file.
2. Run the test.
3. Inspect the output.

What is the expected output? What do you see instead?
-----------------------------------------------------
The expected output from the first unit test is
[/UN/Nicht_zugeordnet/3201902/1.1, /UN/Nicht_zugeordnet/3201902/1.2, 
/UN/Nicht_zugeordnet/3201902/1.3]
[3175,44, 2206,44, 5381,88]
[, , ]

Instead I see 
[/UN/Nicht_zugeordnet/3201902/1.1, /UN/Nicht_zugeordnet/3201902/1.2, 
/UN/Nicht_zugeordnet/3201902/1.3]
[3175,44, 2206,44, 5381,88]
[", , ]

The expected output from the second unit test is
[A, B, C]
[1, 2, 3]
[, , ]

Instead I see
[A, B, C]
[1, 2, 3]
[", , ]


What version of the product are you using? On what operating system?
It happens with both versions 2.3 and 2.4
The operating system is Windows 7.

Please provide any additional information below.

"A";"B";"C"
"3175,44";"2206,44";"5381,88"
"";"";""

Original issue reported on code.google.com by [email protected] on 20 Jun 2014 at 10:55

Attachments:

Empty lines are returned as a result of length 1 with a blank String

What steps will reproduce the problem?

1.   CSV csv = CSV.separator(',')
                    .create();

2.  Import CSV file with blank lines in the data:

Year,Make,Model,Comment,Price CR+LF
1997,Ford,E350,"ac, abs, moon",3000.00 CR+LF
CR+LF <<< THIS LINE
1999,Chevy,"Venture ""Extended Edition""","",4900.00

The 'THIS LINE' is coming back as a String[]{""} instead of just a String[0]


Version 2.4



Original issue reported on code.google.com by [email protected] on 4 Dec 2013 at 1:14

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.