READ CSV with custom encoding in datatable

Hi guys…

I’m trying to read a csv and create a data table to process but the encoding is ‘cp1253’ that is not supported in uipath studio. I Tried all common encodings for Greek language. Some open the file but do not ready properly the content and some others produce an error as ''invalid" file. Does anyone have any idea how to overcome this?

Hi,
The easiest way would be to convert the file to UTF-8 before reading it.
One way to do this is via a small PowerShell command:

Get-Content -Encoding cp1253 .\test.txt | Set-Content -Encoding utf8 test-utf8.txt

If you work with large files you may want to look at other tools such as “iconv” since this command reads the whole file into memory.

Thanks a lot… the power-shell usage gave me the solution.
Just for the info and future reference the syntax that worked for me was

"(Get-Content -Path $csv_path) | Set-Content -Path $csv_path -Encoding UTF8 "

where csv_path is defined in the power-shell variables as the full path of my file.

1 Like

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