I'm having an issue saving an Excel file as a CSV with UTF-8 encoding.
Because I have non standard characters (different language) in my Excel document it caused issues when saved as a CSV. This was solved here by setting the web options encoding to UTF-8.
I am creating a basic C# program that parses data from an Excel file and saves it in CSV format but I cant get it to save using the UTF-8 encoding.
I am using Microsoft.Office.Interop.Excel to work with the Excel files.
This is my code:
private Excel.Application application = new Excel.Application { Visible = false };
private Excel.Workbook Workbook = application.Workbooks.Open(OrigionalFileUrl);
Workbook.SaveAs(NewFileUrl);
I have tried setting
application.DefaultWebOptions.Encoding = MsoEncoding.msoEncodingUTF8;
but it doesnt work and the CSV file that I get is always a mess when it comes to sections with special characters.
Thanks!