cancel
Showing results for 
Search instead for 
Did you mean: 

Saving csv in UTF-8 by default

Harsha3
New Contributor III

Hi Gooday,

I have a requirement to save the csv file in UTF-8 by default . However in csv formatter we have UTF-8 encoding option , on writing the file in “File Writer” using externsion.csv it is getting saved as comma delimited . However, the format / data are preserved while editing in notepad , but on downloading and opening , the data format is getting changed as it is a special character. So please let us know is there any option to achieve this.

Thanks,
Harshavardhana

9 REPLIES 9

Harsha3
New Contributor III

Hi Ptaylor,

We are writing a csv file in a file writer using snap in the smb path . Let me share the property of csv formatter and file writer.

CSV FORMATTER:

image

File writer:

image

So the files from these snaps are generated and placed in the smb path as mentioned in the file writer expression.

My concern is after these files were getting placed in the server , if you simply open the file by double click the inside Vietnamese/Taiwanese characters are changing .

I mentioned like on editing it is proper . I just right clicked and click on the edit option , the contents are opened in notepad where we could see these characters are preserved.

The reason I mentioned above was these csv files are saved in comma delimited . I wanted to save them in the path using CSV -UTF-8 format in the path

image

So wanted to know is that possible.

Thanks,
Harshavardhana

It’s clear from your CSV Formatter settings and from the Notepad screenshot that the CSV file is being correctly written with the UTF-8 encoding, exactly as you want. However, it looks like the spreadsheet software you’re trying to open that file with is assuming a different encoding, probably the default Windows encoding, Windows-1252. So instead of just double-clicking the file to open it in the spreadsheet software, try opening the software first and then import the file, specifying the UTF-8 encoding on the import. Here’s an article about how you would do this in one version of Excel:

and another:

https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_mac-mso_365hp/how-to-open-utf-...

Old question, but I fell in the same trap: Excel assumes that CSV files to be encoded in current locale, unless the CSV file starts with the UTF-8 BOM, which is an option available in the CSV Formatter snap:

image

That’s a valuable observation, Joel. Thank you.

darshthakkar
Valued Contributor

@joel_bourgault: Thanks for sharing your insights, I have faced similar issue with CSV files, I will give it a try.
I wasn’t able to find a solution thus I went with generating an excel file and doing the manual work of getting it converted to UTF-8.