【问题标题】:How to set character encoding in Angular2Csv export?如何在 Angular2Csv 导出中设置字符编码?
【发布时间】:2019-03-26 10:43:40
【问题描述】:

我正在尝试将数据下载到我的 Angular 应用程序上的 CSV 文件中,但是,我无法正确显示像 é à ç è 这样的特殊字符。

如何在使用 Angular2Csv 时将字符编码设置为 UTF-8

我尝试使用 encoding()encodingUI(),但没有成功。

   this.options = {
  fieldSeparator: ';',
  quoteStrings: '"',
  decimalseparator: '.',
  showLabels: true,
  headers: ['Prénom', 'Référence', 'montant', 'Devise', 'Date', 'Date échéance'],
  useBom: false,
};

download(myData) {
let date = new Date();
new Angular2Csv(myData, 'MyCsv' + date.getHours() + '|' + date.getMinutes() + '|' + date.getSeconds(), this.options);

}

【问题讨论】:

    标签: angular character-encoding angular5 export-to-csv export-to-excel


    【解决方案1】:

    来自文档 (https://github.com/javiertelioz/angular2-csv)

    useBom true 如果为 true,则在 CSV 开头添加一个 BOM 字符

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-07
      • 2015-06-20
      • 2010-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多