Convert TXT File Encoding UNIX to Windows

Hello everyone,

I need to convert a TXT file with UNIX encoding for Windows, I found a solution in Vba, but I can’t insert it in the code, could you help me?

'Delete last line
Dim lines As New List(Of String)(IO.File.ReadAllLines(LocalAppData & “\settings.txt”))
'Remove the line to delete, e.g.
lines.RemoveAt(lines.Count - 1)
IO.File.WriteAllLines(LocalAppData & “\settings.txt”, lines.ToArray())

1 Like

Hi,

Can you elaborate about your issue?

If your issue is unable to use the above method in Assign activity, can you try to use InvokeMethod activity or InvokeCode activity?

Regards,

@Israel_Silva

Hello Israel,
you can try this. This sequence reads a text file and changes newline \n with return and newline \r\n. As far as I know is this the only difference between Unix and Windows style text files.
Best regards
Stefan

image

image