Monday 8 May 2017

em dash displayed as black question mark box - character encoding

On my remote AWS EB EC2 instance, I'm running into an issue where my em dashes for a CSV download are being converted to black diamond question marks:

What I'm expecting in the CSV:

enter image description here

What I'm getting:

enter image description here

We're using Node's json2csv to put our database query results into csv:

return json2csv({data: fullReport,
  defaultValue: 'N/A',
  fields: fields});
});

Then passing it back to Angular:

var file = new Blob([response.data], {
  type: 'text/csv',
});

FileSaver.saveAs(file, 'my_filename.csv');

On my frontend Angular app, in head, I have proper encoding:

<meta charset="UTF-8">

I am unable to reproduce this locally, and can hardly reproduce it on my remote server. That being said, where else might the encoding issues lie that cause the em dash to not render?



via Growler

No comments:

Post a Comment