<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to FAQ</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/" rel="alternate"/><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/feed.atom" rel="self"/><id>https://sourceforge.net/p/opencsv/wiki/FAQ/</id><updated>2026-05-26T00:55:36.434000Z</updated><subtitle>Recent changes to FAQ</subtitle><entry><title>FAQ modified by Scott Conway</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/" rel="alternate"/><published>2026-05-26T00:55:36.434000Z</published><updated>2026-05-26T00:55:36.434000Z</updated><author><name>Scott Conway</name><uri>https://sourceforge.net/u/sconway/</uri></author><id>https://sourceforge.net2e06d4bc9b97465bb1de96462a3dac82f7fdc54d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v8
+++ v9
@@ -36,3 +36,28 @@

 # I am getting an error when using the CSVParser
 Unless you are dealing with custom csv files my default recommendation is to switch over to the RFC4180Parser.    The CSVParser was the original parser for opencsv and predates the RFC4180 specification.   It is made for a high degree of customization but there exist data that it, even with all its customizations, it cannot parse.    If the data does follow the RFC4180 specification then use the RFC4180Parser - it will be a lot easier to set up and parse.    
+
+# Reader not recognizing the first header
+Odds are the file you are parsing is an UTF-8 file which has a BOM character as the first character in the file - this causes the first field in the file not to match when using a standard reader as it has the BOM character prepended to it.   Use the Apache Commons [BOMInputStream](https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/input/BOMInputStream.html) and [BOMInputStream.Builder](https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/input/BOMInputStream.Builder.html) to remove the BOM character for you. 
+
+~~~

+    @Test
+    @DisplayName("Show how to handle a utf file with a bom character.")
+    public void testBomHandling() throws IOException {
+        BOMInputStream b = BOMInputStream.builder()
+                .setPath(Paths.get(UTF_FILE_NAME))
+                .setByteOrderMarks(ByteOrderMark.UTF_8)
+                .setInclude(false)
+                .get();
+
+        InputStreamReader ff = new InputStreamReader(b);
+
+        List&amp;lt;job&amp;gt; jobs = new CsvToBeanBuilder(ff)
+                .withType(Job.class).build().parse();
+
+        assertEquals(40, jobs.size());
+    }
+~~~
+
+# Is opencsv OWASP compliant
+No.   Opencsv is designed for one purpose and that is parsing CSV data.    Anything else, specific logic for character sets, specific logic for any sort of compliance, any logic required for a client is up to the user.   We try to make opencsv extensible where possible but at the end of the day our priority is parcing csv data and any extensibility that breaks that will not be allowed.   
&amp;lt;/job&amp;gt;&lt;/pre&gt;
&lt;/div&gt;</summary></entry><entry><title>Discussion for FAQ page</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/?limit=25#15a8/02c4/0565/300e" rel="alternate"/><published>2025-02-24T18:18:33.464000Z</published><updated>2025-02-24T18:18:33.464000Z</updated><author><name>Scott Conway</name><uri>https://sourceforge.net/u/sconway/</uri></author><id>https://sourceforge.net272192b5751b85e81729a48edae879165de6fb42</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;LOL - it is not a death sentence.... But I guess I do understand thinking about it.   I always go to the unit tests for samples but I realized reading my original response that I could because I wrote half of them.   That said the unit tests should be good for part of what you want as they are pretty much stand alone and I am sure there will be test code for the collections.    The downside is you will have to search for it.  &lt;/p&gt;
&lt;p&gt;Consider looking at the CollectionSplitTest.java, JoinTest.java, or FuzzyMappingTest.java. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Discussion for FAQ page</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/?limit=25#15a8/02c4/0565" rel="alternate"/><published>2025-02-24T04:51:02.583000Z</published><updated>2025-02-24T04:51:02.583000Z</updated><author><name>Doug Merrett</name><uri>https://sourceforge.net/u/dmerrett/</uri></author><id>https://sourceforge.net71f021328e14964a0f8cc4820dee0c38cff61ee0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for that Scott.  I will have a dig around.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Discussion for FAQ page</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/?limit=25#15a8/02c4" rel="alternate"/><published>2025-02-23T21:15:38.821000Z</published><updated>2025-02-23T21:15:38.821000Z</updated><author><name>Scott Conway</name><uri>https://sourceforge.net/u/sconway/</uri></author><id>https://sourceforge.net0c3017cbbdee4107370bc82d8a854c8f8da92d3f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello Doug - So there are two sources of examples you can look through other than the documentation (https://opencsv.sourceforge.net/#collection_based_bean_fields_one_to_many_mappings).  One is the unit tests - just clone the repo (https://sourceforge.net/p/opencsv/source/ci/master/tree/) and search through the existing unit tests and integration tests and I am sure there will be samples of what you are looking for.   The other is searching or asking on stack overflow (https://stackoverflow.com/search?tab=newest&amp;amp;q=opencsv&amp;amp;searchOn=3) - search first then ask.   &lt;/p&gt;
&lt;p&gt;But as for making any additions to the documentation just for clarification puroposes will be a long time coming because of limitations on time and resources.  &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Discussion for FAQ page</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/?limit=25#15a8" rel="alternate"/><published>2025-02-20T05:23:05.620000Z</published><updated>2025-02-20T05:23:05.620000Z</updated><author><name>Doug Merrett</name><uri>https://sourceforge.net/u/dmerrett/</uri></author><id>https://sourceforge.neta73271289b5e0b0f85a5014d49f77324d3ff60bf</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi folks, may I ask a favour?  Your samples directory in the source area is very, very light on in the way of code.  There is only one simple example and the snippets in the documentation do not compile correctly.  I fully understand I am a java newbie, however I learn by reading and have tried many other sites trying to get a bean reader working.  Could you please post the complete code used for the snippets in the &lt;em&gt;Collection-based bean fields (one-to-many mappings)&lt;/em&gt; area of the doc?  Preferably, complete code for all the example snippets.  I am sure there are many others out there that would also appreciate it. Thanks...  &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>FAQ modified by Scott Conway</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/" rel="alternate"/><published>2023-11-05T23:47:32.863000Z</published><updated>2023-11-05T23:47:32.863000Z</updated><author><name>Scott Conway</name><uri>https://sourceforge.net/u/sconway/</uri></author><id>https://sourceforge.net3ac9ddc60da45df698c5de825daaeeed62817b2f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v7
+++ v8
@@ -34,3 +34,5 @@

 Another possibility is to try another csv library.   I checked apache commons csv and super-csv and apache does not convert to beans but super-csv does using only reflection.  

+# I am getting an error when using the CSVParser
+Unless you are dealing with custom csv files my default recommendation is to switch over to the RFC4180Parser.    The CSVParser was the original parser for opencsv and predates the RFC4180 specification.   It is made for a high degree of customization but there exist data that it, even with all its customizations, it cannot parse.    If the data does follow the RFC4180 specification then use the RFC4180Parser - it will be a lot easier to set up and parse.    
&lt;/pre&gt;
&lt;/div&gt;</summary></entry><entry><title>Discussion for FAQ page</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/?limit=25#f72f/206f" rel="alternate"/><published>2022-06-06T05:47:31.069000Z</published><updated>2022-06-06T05:47:31.069000Z</updated><author><name>Scott Conway</name><uri>https://sourceforge.net/u/sconway/</uri></author><id>https://sourceforge.netb91670e1acfe454a5c88187bf633eb00af409fd6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The only thing I can think of offhand is to have a finally statment in the try catch where you flush the writer.   &lt;/p&gt;
&lt;p&gt;finally {&lt;br/&gt;
   csvWriter.flush();&lt;br/&gt;
   }&lt;/p&gt;
&lt;p&gt;though in you code you should probably put it between the writeAll and the getByteCount to force the count to be correct.. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Discussion for FAQ page</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/?limit=25#f72f" rel="alternate"/><published>2022-06-01T07:23:54.712000Z</published><updated>2022-06-01T07:23:54.712000Z</updated><author><name>Sanjay</name><uri>https://sourceforge.net/u/sanjay12345/</uri></author><id>https://sourceforge.netd68c0c29fde95cb382b535c3e3f3005a6b06f253</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
CSVWriter is not writing all the data from the resultset, It is breaking in between. In my resultSet have 2200 record but the csv file is generate only 1401 record, it is breaking in between.&lt;br/&gt;
This is intimetent issue, some time it writes whole data and some time its break in between.&lt;br/&gt;
I am using StreamingResponseBody with below code:&lt;/p&gt;
&lt;p&gt;private double writeToOutputStreamUsingCSVWriter(OutputStream outputStream, ResultSet resultSet,&lt;br/&gt;
    DownloadMaster downloadMaster) {&lt;br/&gt;
  double totalBytes = 0;&lt;/p&gt;
&lt;p&gt;if (Objects.nonNull(outputStream) &amp;amp;&amp;amp; Objects.nonNull(resultSet)) {&lt;br/&gt;
    try (CountingOutputStream counterStream = new CountingOutputStream(outputStream);&lt;br/&gt;
        BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(counterStream));&lt;br/&gt;
        CSVWriter csvWriter = new CSVWriter(bufferedWriter)) {&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb nb-Type"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;csvTotalRecord&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;csvWriter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;writeAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resultSet&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ResultSet writing is completed, csvTotalRecord are : {}, request key  : {}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;csvTotalRecord&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;downloadMaster&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getId&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;

&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;totalBytes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;counterStream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getByteCount&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;catch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ClientAbortException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;NullPointerException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nb"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Client abort error while writing to output stream : {}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;downloadMaster&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getId&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;catch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nb"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Error while writing to output stream : {}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;downloadMaster&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getId&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;}&lt;br/&gt;
  return totalBytes;&lt;br/&gt;
}&lt;/p&gt;
&lt;p&gt;Could you please help me.&lt;br/&gt;
Thanks.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Discussion for FAQ page</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/?limit=25#a2b0/c04e" rel="alternate"/><published>2021-03-17T18:50:52.931000Z</published><updated>2021-03-17T18:50:52.931000Z</updated><author><name>Andrew Rucker Jones</name><uri>https://sourceforge.net/u/aruckerjones/</uri></author><id>https://sourceforge.netc84db5aa4f713aa1b666c7c455d3a45066ecd464</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Would you please open a regular ticket for this and include:&lt;br/&gt;
1. Code, and&lt;br/&gt;
2. Data?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Discussion for FAQ page</title><link href="https://sourceforge.net/p/opencsv/wiki/FAQ/?limit=25#a2b0" rel="alternate"/><published>2021-03-17T18:27:04.434000Z</published><updated>2021-03-17T18:27:04.434000Z</updated><author><name>Juan Manuel Buendia</name><uri>https://sourceforge.net/u/ruisenor/</uri></author><id>https://sourceforge.net540ab0077cf89e2702a72945fb869ca7fb10baab</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Good morning,&lt;br/&gt;
I want to use CSVWriter or CSVParserWriter to output the file in .csv format (as opposed a .txt, etc). When I look at the .csv file, I want the file to have leading 0s (no converstion of any of my ctring arrays to number.  So if I output the following:&lt;br/&gt;
String[] array = {"0000001", "02345698", "120", "3" , "10"};&lt;br/&gt;
I should see the following cells in my .csv file:&lt;br/&gt;
0000001         02345698            120                     3                     10&lt;br/&gt;
currenlty, using writer, I get the following:&lt;br/&gt;
1            2345698            120                   3                         10&lt;/p&gt;
&lt;p&gt;Please help, thank you&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>