title: Handling extra newlines in csv files parsed with Scala?
body: <p>I'm totally new to Scala, and am trying to parse a CSV file that has carriage return/new line/and other special characters like comma in some of the cells (i.e. within double quotations), for example:</p>
  
  <pre><code>"A","B","C\n,FF\n","D"\n
  "Q","W","E","R\n\n"\n
  "1","2\n","2","2,2\n"\n
  </code></pre>
  
  <p>I want to load this into a list of lists type in Scala, like the following:</p>
  
  <pre><code>List(List("A","B","C,FF","D"),List("Q","W","E","R"),List("1","2","2","2,2"))
  </code></pre>
  
  <p>Any suggestions how it can be done?</p>
  
  <p>I have found some solutions for the same problem in other languages. For example this is a great one in Python, which I understand well: <a href="https://stackoverflow.com/questions/11146564/handling-extra-newlines-carriage-returns-in-csv-files-parsed-with-python">Handling extra newlines (carriage returns) in csv files parsed with Python?</a></p>
  
  <p>My try:</p>
  
  <pre><code>val src2 = Source.fromFile("sourceFileName.csv")
  val it =src2.getLines()
  val data = for (i&lt;-it) yield i.replace("\"","").split(",")
  </code></pre>
  
  <p>But it looks like all carriage returns are seen as new lines.</p>