CSV import encoding

I am try to imort csv with russian text with utf8 encoding from clickup. File:

After downloading contact i have incorrect encoding:

I am import data from url(from crm)

Fixed by read binary data via function node

//var csv is the CSV file with headers
function csvJSON(csv){

  var lines=csv.split("\n");

  var result = [];

  // NOTE: If your columns contain commas in their values, you'll need
  // to deal with those before doing the next step 
  // (you might convert them to &&& or something, then covert them back later)
  // jsfiddle showing the issue https://jsfiddle.net/
  var headers=lines[0].split(",");

  for(var i=1;i<lines.length;i++){

      var obj = {};
      var currentline=lines[i].split(",");

      for(var j=0;j<headers.length;j++){
          obj[headers[j]] = currentline[j];
      }

      result.push(obj);

  }

  return result;
}

return [{json:  csvJSON(Buffer.from(items[0].binary.data.data, 'base64').toString('utf8'))[0] }]
2 Likes