Hi Experts
I need to read the content of a zip file and output the files within the zip file to a list. I have managed to do that with an Invoke Code activity adding the following code snip:
List<string> fileNames = new List<string>();
try {
using (ZipArchive zipArchive = ZipFile.OpenRead(in_ZipFile)) {
foreach (ZipArchiveEntry entry in zipArchive.Entries) {
fileNames.Add(entry.FullName);
}
}
out_FilesList = fileNames;
}
catch (Exception ex) {
Console.WriteLine(ex.Message);
}
foreach (string fileName in fileNames) {
Console.WriteLine(fileName);
}
To code snip above works but there seem to be an issue with non A-Z characters e.g., æ, ø and å being replaced by �. Clearly this has to do with the encoding.
When using a Python script I can see that using code page 437 the characters are displayed correct in the Python terminal.
In the Invoke Code I have then tried adding the following line:
string decodedFilename = System.Text.Encoding.GetEncoding(437).GetString(System.Text.Encoding.GetEncoding(437).GetBytes(entry.FullName));
But now the characters are being replaced by a regular question mark.
Any ideas on how to get the characters to show correct in UiPath as well?