You are currently viewing How to make a csv file utf-8 encoded?

How to make a csv file utf-8 encoded?

In this blog post, we will learn how to make a csv file utf-8 encoded we will create a .csv file that uses UTF-8 character encoding.

How to make a cSV file utf-8 encoded?

Problem

We need to save csv file in utf-8 encoding, When we use Create file action in Power Automate to create CSV file that contain Arabic characters or any other UTF-8 character encoding, The file created with Stanga character as shown in the following file .

title | Power Platform Geeks

So we need to solve this issue and create a correct file encoded by UTF-8.

Solution

To solve this issue we need to create the file correctly and make the reader to guess that the file created is encoded by UTF-8.

So we need to add the BOM characters to the content of the file as when you generate .csv file in Power Automate, it does not include BOM.

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

We will perform this using the help of the decodeUriComponent function that Return a string that replaces escape characters with decoded versions.

So in the create File you will concatenate your CSV file content withe the decodeUriComponent (‘%EF%BB%BF’)

How to make a csv file utf-8 encoded?

So the solution of how to make a csv file utf-8 encoded is to add 3 BOM characters in front of the .csv file content before saving it.

Save and run Your flow, Now it will create the .csv file that uses UTF-8 character encoding

13 | Power Platform Geeks
See Also
Join us

Heba Kamal

Microsoft MVP, MCT, Technical Speaker, Blogger, and Microsoft 365 and Power Platform Consultant.