We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Encoding for CSV Files


I want to set Encoding for opening CSV files. I am using;

LoadOptions loadOptions = new LoadOptions(LoadFormat.CSV);

LoadOptions does not have a property for Encoding while TxtLoadOptions has.

Setting LanguageCode or Region did not worked. 

It would be better if Aspose can detect encoding, but if not, how can I set it manually?

Thank you,


Well, you will use TxtLoadOptions class and set your desired encoding type accordingly. See the sample code below for your reference:
Sample code:

TxtLoadOptions txtLoadOptions = new TxtLoadOptions(LoadFormat.CSV);

//Specify the encoding type
txtLoadOptions.Encoding = System.Text.Encoding.UTF8;

//Create a Workbook object and opening the file from its path
Workbook wb = new Workbook(“e:\test\abc.csv”, txtLoadOptions);

Hope, this helps a bit.

Thank you.

Thank you for quick response.

It helped.


It is good to know that you are up & running again. Please feel free to contact us back in case you need our further assistance with Aspose APIs.