Data Tables: Special Chars Excel Export
Demonstration of undesired behavior when using Buttons 1.2.1 to export table to excel when data includes characters that xml requires be encoded
HTML
<link rel="stylesheet" href="https://cdn.datatables.net/u/ju-1.11.4/jqc-1.12.3,jszip-2.5.0,dt-1.10.12,b-1.2.1,b-html5-1.2.1/datatables.min.css">
<script src="https://cdn.datatables.net/u/ju-1.11.4/jqc-1.12.3,jszip-2.5.0,dt-1.10.12,b-1.2.1,b-html5-1.2.1/datatables.min.js"></script>
<p>
Click the <b>Excel</b> button to view the export.
</p>
<table id="test-table">
<thead>
<tr>
<th>Test</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
JavaScript
$(document).ready(function() {
$("#test-table").DataTable({
dom: 'Bfrtip',
buttons: [
'excel'
],
data: [{"Test":"1 & 2"}, {"Test":"3 < 4"},{"Test": "6 > 5"}],
columns: [{data: 'Test'}]
});
});