title: How to parse CSV data that contains newlines in field using JavaScript
body: <p>Given a CSV file that has newline/return characters in certain fields, how do we parse the data without splitting a field into multiple rows.</p>
  
  <p>Example CSV Data:</p>
  
  <pre><code>ID;Name;Country;ISO-2;Address;Latitude;Longitude
  022wje3;Europa;Italy;IT;"Viale Kennedy 3
  34073 Grado";"45,67960";"13,40070"
  024oua5;Hiberia;Italy;IT;"Via XXIV Maggio 8
  00187 Rome";"41,89720";"12,48680"
  028gupn;Regal Riverside;Hong Kong;HK;"34-36 Tai Chung Kiu Road
  Shatin
  Hong Kong";"22,38260";"114,19600"
  02j7qry;Okaliptus Holiday Villas Apart;Turkey;TR;"Sevket Sabanci Caddesi No. 70
  Bahçelievler Mevkii
  Turgutreis";"37,02130";"27,25120"
  02pc99z;California Apartementos;Spain;ES;"Prat d'en Carbó
  43840 Salou";"41,07620";"1,14667"
  02tu1jz;Elvis Presley's Heartbreak;United States;US;"3677 Elvis Presley Blvd.
  Memphis
  Tennessee 38116";"35,04850";"-90,02710"
  </code></pre>
  
  <blockquote>
    <p><em>Note: fields are actually separated by semicolon <code>;</code> because Address can contain commas</em></p>
  </blockquote>
  
  <p>Each row has 7 fields but we don't want to mistakenly parse data in a field containing newline characters as multiple rows...</p>
  
  <p>We found a few Perl-focussed answers on StackOverflow:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/9931159/how-to-parse-csvs-with-newline-and-commas-inside-a-field-in-perl">How to parse CSVs with newline and commas inside a field in Perl?</a></li>
  <li><a href="https://stackoverflow.com/questions/18485762/textcsv-parsing-when-data-contains-newline">Text::CSV parsing when data contains newline</a></li>
  </ul>
  
  <p>but I'm a bit rusty on Perl and have not discovered a JS-focussed answer. </p>