cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Create a .csv file that uses UTF-8 character encoding

Hello,

as the title of the subject already suggests: I want to create a .csv file that uses UTF-8 character encoding.

 

The background is the following:

On a daily basis I retrieve data from Dynamics 365, create a new .csv table and save it in our SharePoint.

For example, if it was a table displaying the past invoices, ideally it would look like

 

currency, amount, invoice_id, customer_name

EUR, 100, 20514_abc, some_näme

 

The flow works totally fine so far - however, customer_name from the example above would be displayed as "some_näme" ...

All I got from my research so far is this post and I am still quite lost. What am I missing?

 

Thanks a lot in advance - I am looking forward to your replies.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
chanwulee
Advocate I
Advocate I

Hi @v-litu-msft ,

 

.csv file is a kind of text file. If you encode it in UTF-8 format, there are two ways to save it.

- Text only

Byte Order Mark(BOM)+Text

BOM is 3 characters (EF BB BF) to mark the file is encoded as UTF-8.

When you generate .csv file in Power Automate, it does not include BOM.

So, when you open the .csv file in excel, special characters(i.e. Korean) will be broken.

 

The solution is to add 3 BOM characters in front of the .csv file content before saving it.

 

concat(uriComponentToString('%EF%BB%BF'),body('Create_CSV_table'))

 

View solution in original post

17 REPLIES 17
v-litu-msft
Community Support
Community Support

Hi @Anonymous,

 

This is a known issue and not caused by Flow, there is no solution could do in the Flow side, sorry.

https://www.i18nqa.com/debug/utf8-debug.html

 

As a workaround, the only way could do in my mind is to use the text replace feature to replace these "ä" to "ä":Annotation 2020-05-15 141458.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks a lot for your fast reply!

Hopefully it's going to be implemented one day, better soon than late.

 

Unfortunately, the workaround won't be a satisfying solution for our issue...

It's way too much effort to use the find and replace option any time for several letters that aren't encoded properly - for any single .csv table created on a daily basis.

 

Maybe there are others having the same issue who just found another workaround that might fit here?

ChristopherBor
Regular Visitor

To my awareness the built in csv creator in flow generates a csv file with UTF-8, the problem stems from the system thinking the csv file is some other format than UTF-8.

 

If you are opening the file in excel, you can use the import function and specify that it is utf-8, which should fix the issue.

 

This guide is old, but the concept is still the same:

https://www.itg.ias.edu/content/how-import-csv-file-uses-utf-8-character-encoding-0

chanwulee
Advocate I
Advocate I

Hi @v-litu-msft ,

 

.csv file is a kind of text file. If you encode it in UTF-8 format, there are two ways to save it.

- Text only

Byte Order Mark(BOM)+Text

BOM is 3 characters (EF BB BF) to mark the file is encoded as UTF-8.

When you generate .csv file in Power Automate, it does not include BOM.

So, when you open the .csv file in excel, special characters(i.e. Korean) will be broken.

 

The solution is to add 3 BOM characters in front of the .csv file content before saving it.

 

concat(uriComponentToString('%EF%BB%BF'),body('Create_CSV_table'))

 

karacsondi
Frequent Visitor

Brilliant solution @chanwulee ! Thanks a lot! 

nantanis
Frequent Visitor

@chanwulee Your method needs to be more acknowledged. Thank you!

@chanwulee Thanks for this solution, really caused me a headache.

dignus93reply
Helper I
Helper I

@chanwulee Works good. You are a legend. Daje forte!

Hi, I have the same issue, but I cannot understand the solution.

How do I use the line of code, when I want to export the data in a table visual?

I only see the option to Export Data and then I am asked where to save the file.

 

In the Create File step, you should put 

concat(uriComponentToString('%EF%BB%BF'),body('Create_CSV_table')) in File Content field.

Great solution
Really does the job
Just one small query, when creating CSV this way - I get a CSV with some rows in crazy heights (e.g 200px or even more).

How can I define in the flow that all rows must be 15px?

Any ideas 💡with latin  characters like 'ñ' 'í' 'ó' 'á', couldn't figure out the BOM characters requiered.

dignus93reply
Helper I
Helper I

@chanwulee 
I come back here after my last reply. Everything works except from one character. One cursed characters "à"
It's so strange because the capital version À works fine

@groyet 
all the characters you are listing in your reply works for me.

Any ideas?


That "à" was painful but i solved replacing it manually before creating the file and concat the BOM. In detail my flow had a list rows, parse json, select, create csv table, create file in sharepoint. Here is a screenshot:

dignus93reply_3-1649757470070.png

 

The NOTE UTENTE field is the one with "à" special character. So in the Select action i put this expression

decodeUriComponent(
replace(
uriComponent(item()?['crcef_anagrafica_utenti2.crcef_note'],null),'%C3%A0','à')
)

I find the url code of "à" that is "%C3%A0". I convert the field in uri component, I replace C3A0 with à, then I decode the uri component.
After the Create CSV table 2 action there is the Create file in sharepoint action

dignus93reply_4-1649757634176.png

Where in the file content I put this

concat(uriComponentToString('%EF%BB%BF'),body('Create_CSV_table_2'))

 

Thanks to all your precious tips!

Wonderful! 

BegeNCSU
Advocate II
Advocate II

@chanwuleeis an absolute legend! Thank you very much for this solution.

You saved my Day @chanwulee!👍 Many Thanks for your solution!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (4,757)