title: Export HTML table to csv in google chrome browser
body: <p>i have following function by using this i am exporting my html to Csv file. few days/months ago it was working fine in google chrome browser <strong>(still its working fine in FF)</strong>. now suddenly it stops working to convert data in to csv format.</p>
  
  <p>when i am clicking on <strong>export</strong> button i am able to download file but when i am trying to opening in <strong>ms excel/Libre office calc</strong> its not opening in it.</p>
  
  <p>i can see even exported data also but its showing same as , separated.</p>
  
  <p>can anyone suggest me whats going wrong with my code in google chrome browser.    </p>
  
  <pre><code>   function exportReportTableToCSV($table, filename) {
      var dumpd='';
      var csvData ='';
  
      $table.each(function(){
              var $rows = $(this).find('tr:has(td)');
              var  $header =  $(this).find('tr:has(th)');                
  
                  tmpColDelim = String.fromCharCode(11), // vertical tab character
                  tmpRowDelim = String.fromCharCode(0), // null character
  
                  colDelim = '","',
                  rowDelim = '"\r\n"',
  
                  csv = '"' + $header.map(function (i, head) {
                      var $head = $(head),
                          $cols = $head.find('th');
  
                      return $cols.map(function (j, col) {
                          var $col = $(col),
                              text = $col.text();
  
                          if(text == "&amp;nbsp;")
                                  text = "";
                          if(text == "PROGRAMS")
                                  text = "";
                          console.log(text);
                          return text.replace('"', '""'); 
  
                      }).get().join(tmpColDelim);
  
                  }).get().join(tmpRowDelim)
                      .split(tmpRowDelim).join(rowDelim)
                      .split(tmpColDelim).join(colDelim) + '"' ;
  
              csv+='\r\n';
  
              csv+= '"' + $rows.map(function (i, row) {
                      var $row = $(row),
                          $cols = $row.find('td');
  
                      return $cols.map(function (j, col) {
                          var $col = $(col);
                          var text;
                             if($($(col)).find("input:checkbox").length &gt; 0)
                                  text = $($(col)).find("input:checkbox").prop('checked') ? 'Yes' : 'No';
                              else
                                  text = $col.text();
  
                              if(text === "")
                              {
                                  text = "";
                              }
  
                          return text.replace('"', '""'); 
  
                      }).get().join(tmpColDelim);
  
                  }).get().join(tmpRowDelim)
                      .split(tmpRowDelim).join(rowDelim)
                      .split(tmpColDelim).join(colDelim) + '"';
  
              dumpd+=csv+"\n\n";
         });
  
  
      csvData ='data:application/csv;charset=utf-8,' + encodeURIComponent(dumpd);
  
      $(this)
          .attr({
          'download': filename,
              'href': csvData,
              'target': '_blank'
      });
  }
  </code></pre>