I am having trouble exporting some data from one meteor application (meteor application 1) as a CSV, then uploading that CSV file to a separate meteor application (meteor application 2) . Specifically, while the file is exported from meteor application 1 with utf-8 encoding, I do not know how to “tell” meteor application 2 that the csv encoded in utf-8 format. As a result, the data, as received by meteor application 2 gets corrupted with utf-8 jargon like “%u2019” etc
I’m using the package clinical:csv from atmosphere.js, which is built on top of Papa Parse.
The relevant exporting lines of code in meteor application 1 are:
'click #exportMe':function(){
var csvContent = CSV.unparse(Tasks.find().fetch());
window.open('data:text/csv;charset=utf-8,' + escape(csvContent), '_self');
},
The relevant importing lines of code in meteor application 2 are:
Template.example.events({
'change #hiddenUpload': function(event){
var filesList = event.currentTarget.files;
var file = filesList[0];
Papa.parse(file, {
header:true,
complete: function(results) {
var data = results.data
Meteor.call('tasks.batch',data)
}
});
},
})
I would guess that there would be a way of specifying in the importing code, that it’s encoded in utf-8, but have not been able to find anything in any relevant documentation.
Would be really grateful for any help.