How to convert a csv file with utf-8 is BOM coding to utf-8 without BOM

Hi,

I create a csv file with write csv activity, and leave the encoding blank or “utf-8” and in both situations the file is “utf-8 with BOM”. My Studio version is enterprise 20.10, I saw a post to do via PowerShell script but I don’t know how to do it, can you help me please?

https://forum.uipath.com/t/how-to-convert-a-txt-file-with-ansi-coding-to-utf-8-without-bom/60455/4



image

have a look here on writing it out on UTF-8 without BOM

is it correct the way I did it? but it’s giving an error

you have to convert the datatable into a string before.
Depending to your requirements on csv:

  • use the output datatable activity
  • or do it custom

in case you need more help on this, let us know the requirements for the csv like delimiter char etc.

I need help yes, I’m new to the RPA world, the csv delimiter is semicolon keeping the header.

give a first try on following:
Variables:
grafik

Flow:
grafik

strHeaderLine =
String.Join(";", dtData.Columns.Cast(Of DataColumn).Select(Function (x) x.ColumnName))

DataLines =

(From d In dtData.AsEnumerable
Let s = String.Join(";",d.ItemArray)
Select s).toList

DataLines = DataLines.Prepend(strHeaderLine).toList

strCSV = String.Join(Environment.NewLine, DataLines)

input/output:
grafik

1 Like

I did everything as you told me, I’m still wrong

ensure following import is done or import it:
grafik

It worked, thanks for your willingness to help me solve the problem, you’re awesome

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.