Create CSV files with BOM marker in Logic App

Published Nov 02 2021 11:55 PM 732 Views
Microsoft

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

 

 

 

%3CLINGO-SUB%20id%3D%22lingo-sub-2919113%22%20slang%3D%22en-US%22%3ECreate%20CSV%20files%20with%20BOM%20marker%20in%20Logic%20App%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2919113%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3EBackground%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EIn%20Logic%20App%2C%20we%20can%20use%20%22Create%20CSV%20Table%22%20action%20to%20create%20a%20CSV%20file%2C%20but%20by%20default%2C%20it%20will%20not%20contain%20BOM%20marker%20which%20will%20not%20be%20able%20to%20display%20special%20characters%20(for%20example%20Chinese).%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Drac_Zhang_0-1635908051205.png%22%20style%3D%22width%3A%20648px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F323581i25FFD57C514E1025%2Fimage-dimensions%2F648x469%3Fv%3Dv2%22%20width%3D%22648%22%20height%3D%22469%22%20role%3D%22button%22%20title%3D%22Drac_Zhang_0-1635908051205.png%22%20alt%3D%22Drac_Zhang_0-1635908051205.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EInvestigation%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EFor%20the%20CSV%20format%2C%20if%20we%20want%20to%20display%20non-ASCII%20characters%2C%20we%20need%20to%20put%20the%20BOM%20marker%20at%20the%20beginning%20of%20the%20text%20content%20to%20let%20the%20application%20be%20able%20to%20handle%20those%20characters.%3C%2FP%3E%0A%3CP%3EReference%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FByte_order_mark%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EByte%20order%20mark%20-%20Wikipedia%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EResolution%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EAs%20per%20the%20document%2C%20the%20only%20thing%20we%20need%20to%20do%20is%20to%20append%20BOM%20marker%20at%20the%20beginning%20of%20our%20CSV%20content.%3C%2FP%3E%0A%3CP%3EThe%20UTF-8%20code%20for%20the%20BOM%20is%200xEFBBBF%2C%20but%20we%20cannot%20use%20this%20code%20in%20Logic%20App%20directly.%3C%2FP%3E%0A%3CP%3ESo%20the%20resolution%20is%20to%20use%20a%20tool%20to%20convert%20the%20code%20into%20the%20exact%20character.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Drac_Zhang_0-1635918700511.png%22%20style%3D%22width%3A%20510px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F323631i9B23B52A24C4220B%2Fimage-dimensions%2F510x315%3Fv%3Dv2%22%20width%3D%22510%22%20height%3D%22315%22%20role%3D%22button%22%20title%3D%22Drac_Zhang_0-1635918700511.png%22%20alt%3D%22Drac_Zhang_0-1635918700511.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAlthough%20there's%20nothing%20displayed%20in%20the%20output%20textbox%2C%20but%20the%20character%20has%20been%20decoded%20and%20it%20is%20a%20invisible%20character.%3C%2FP%3E%0A%3CP%3EThen%20we%20can%20use%20Ctrl%2BA%20and%20Ctrl%2BC%20to%20copy%20and%20paste%20it%20into%20Logic%20App.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20code%20view%2C%20we%20can%20see%20this%20character%20is%20displayed%20as%20a%20special%20character.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Drac_Zhang_1-1635918840097.png%22%20style%3D%22width%3A%20579px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F323632i69A248271CA8E264%2Fimage-dimensions%2F579x196%3Fv%3Dv2%22%20width%3D%22579%22%20height%3D%22196%22%20role%3D%22button%22%20title%3D%22Drac_Zhang_1-1635918840097.png%22%20alt%3D%22Drac_Zhang_1-1635918840097.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20run%20the%20Logic%20App%2C%20the%20Chinese%20characters%20can%20be%20shown%20properly.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Drac_Zhang_2-1635918882140.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F323633iAB2FBDEFC328ACEC%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Drac_Zhang_2-1635918882140.png%22%20alt%3D%22Drac_Zhang_2-1635918882140.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2919113%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ELogic%20Apps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Nov 02 2021 11:37 PM
Updated by: