Utf 8 vs ANSI
Utf 8 vs ANSI
I´m using the "csvtotable" jquery script to render a table from a csv file, and then, I apply datatable. The problem is that the csv is encoded in ANSI (don´t ask me why, but is mandatory) and datatables rendered the table wrong, with strange symbols.
I attempted changing datables and csvtotable codification, but the script failure. If someone can help me please...thanks
I attach part of the code:
[code]
$(function() {
$.get('bbdd.csv', function(data) {
$('#CSVSource').html('' + data + '');
});
$('#CSVTable2').CSVToTable('bbdd.csv' , {separator: ";", loadingImage: 'images/loading.gif', startLine: 1, headers: ['Marca', 'Producto', 'Contacto', 'Teléfono 1', 'Teléfono 2','Email','Página web','Dirección']}).bind("loadComplete",function() {
$('#processingDiv').show();
var oTable = $('#CSVTable2').find('TABLE').dataTable( {
"aoColumns": [
{ "sWidth": "200px" },
{ "sWidth": "600px" },
{ "sWidth": "200px" },
{ "sWidth": "250px" },
{ "sWidth": "400px" },
{ "sWidth": "200px" },
{ "sWidth": "200px" },
{ "sWidth": "1600px"} ,],
"bJQueryUI": true,
"aaSorting":[[1,'asc']],
"sScrollX": "100%",
"sScrollXInner": "140%",
"bScrollCollapse": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 8,
"oLanguage": {
"sLengthMenu": 'Mostrar '+
'8'+
'16'+
'22'+
'28'+
'34'+
'Todas'+
' entradas'
},
"fnInitComplete": function() { $('#processingDiv').hide();
}
} );
new FixedColumns( oTable );
} );
} );
[/code]
I attempted changing datables and csvtotable codification, but the script failure. If someone can help me please...thanks
I attach part of the code:
[code]
$(function() {
$.get('bbdd.csv', function(data) {
$('#CSVSource').html('' + data + '');
});
$('#CSVTable2').CSVToTable('bbdd.csv' , {separator: ";", loadingImage: 'images/loading.gif', startLine: 1, headers: ['Marca', 'Producto', 'Contacto', 'Teléfono 1', 'Teléfono 2','Email','Página web','Dirección']}).bind("loadComplete",function() {
$('#processingDiv').show();
var oTable = $('#CSVTable2').find('TABLE').dataTable( {
"aoColumns": [
{ "sWidth": "200px" },
{ "sWidth": "600px" },
{ "sWidth": "200px" },
{ "sWidth": "250px" },
{ "sWidth": "400px" },
{ "sWidth": "200px" },
{ "sWidth": "200px" },
{ "sWidth": "1600px"} ,],
"bJQueryUI": true,
"aaSorting":[[1,'asc']],
"sScrollX": "100%",
"sScrollXInner": "140%",
"bScrollCollapse": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 8,
"oLanguage": {
"sLengthMenu": 'Mostrar '+
'8'+
'16'+
'22'+
'28'+
'34'+
'Todas'+
' entradas'
},
"fnInitComplete": function() { $('#processingDiv').hide();
}
} );
new FixedColumns( oTable );
} );
} );
[/code]
This discussion has been closed.
Replies
Allan
I´m not able to use iconv with my code.