Wednesday, November 3, 2021

Create CSV files with BOM marker in Logic App

Background

In Logic App, we can use "Create CSV Table" action to create a CSV file, but by default, it will not contain BOM marker which will not be able to display special characters (for example Chinese).

Drac_Zhang_0-1635908051205.png

 

Investigation

For the CSV format, if we want to display non-ASCII characters, we need to put the BOM marker at the beginning of the text content to let the application be able to handle those characters.

Reference: Byte order mark - Wikipedia

 

Resolution

As per the document, the only thing we need to do is to append BOM marker at the beginning of our CSV content.

The UTF-8 code for the BOM is 0xEFBBBF, but we cannot use this code in Logic App directly.

So the resolution is to use a tool to convert the code into the exact character.

Drac_Zhang_0-1635918700511.png

Although there's nothing displayed in the output textbox, but the character has been decoded and it is a invisible character.

Then we can use Ctrl+A and Ctrl+C to copy and paste it into Logic App.

 

In the code view, we can see this character is displayed as a special character.

Drac_Zhang_1-1635918840097.png

 

After run the Logic App, the Chinese characters can be shown properly.

Drac_Zhang_2-1635918882140.png

 

 

 

Posted at https://sl.advdat.com/3CSqDhq