I am running python natively installed in WSL ubuntu that runs a powershell to get a list of files in serveral folders and their creation time. like this
command = r''' powershell.exe -Command "(Get-ChildItem -Path 'folder_path' -File -Recurse | Where-Object { \$_.CreationTime.AddSeconds(-\$_.CreationTime.Seconds) -ge \$(\$(get-date).AddMinutes(-5).AddSeconds(-\$(get-date).Second) )}).FullName" '''
result = subprocess.run(
command, shell=True, check=True,
capture_output=True, text=True, encoding='iso-8859-7'
)
The problem is that some characters in that file name are in Greek and no matter what i try they are not displaying correctly in result.stdout
i tried several encodings, like 'iso-8859-7', 'iso-8859-1', 'latin-1' all failed to display the greek characters correctly. utf8 displays this error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 45: invalid continuation byte.