0

I am trying to export data containing chinese(some non-english characters for that matter) from ui-grid to pdf or CSV. However the exported text is all garbled. Here is the plnkr link

http://plnkr.co/edit/ZR34lhm3LUNmUrj7Vg23?p=preview

I understand for the pdf export to work I need to have the correct cmap for the font and characterset in use but why is CSV export not working? I have even tried exporterOlderExcelCompatibility: false but that didn't help either.

enter image description here

Brian
  • 4,921
  • 3
  • 20
  • 29
Angry Samurai
  • 66
  • 2
  • 7

3 Answers3

1

Did you try with:

exporterOlderExcelCompatibility: true

(false is the default).

I had a problem exporting Umlaut character to CSV, and I fixed it using exporterOlderExcelCompatibility: true in the gridOptions configuration.

matteogll
  • 803
  • 8
  • 16
0

The issue you are facing with the CSV is most likely due to opening this in Excel. I do not face the issue with OpenOffice.

For Excel 2013, these steps should work:

  1. Launch Excel, and go to the Data tab.
  2. Click the From Text button.
  3. Navigate to the exported file, and click open.
  4. Set the encoding to UTF-8 if it wasn't auto-selected.
  5. Click Next.
  6. Change the delimeter to comma.
  7. Click Finish.
  8. Choose where you want the input, or just click OK.

At this point, you should have the CSV displaying correctly.

With the CSV exporter, CSV-JS, I do not see any options to set the encoding before hand.

Brian
  • 4,921
  • 3
  • 20
  • 29
  • Thank you @brianslattery your answer is basically right, except the fact that I am on Excel 2011(Mac) and the steps to import were _File > Import > CSV File_ and then change the **File Origin** to **Simplified Chinese (Mac OS)**. – Angry Samurai Jun 03 '16 at 18:50
0
  • If you have small file: open your csv using Google sheet. and save it as csv. It will work.
  • if you have large file: try open office( free and easy to download). Open with Open Office excel and save as utf-8. The default English Windows encoding for Chinese is GBK. For Ubuntu is utf8t. Make sure you have the irght encoding for your system.
Jim
  • 385
  • 1
  • 3
  • 7