1

I need to mirror files from an FTP server to a local machine, but some files/directories have special characters on it, e.g:

print(ftp.nlst())
>>{'Mariana', 'Marina', 'MartÃ\xadn', 'MatÃ\xadas'}
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Franmuzzio
  • 25
  • 5

1 Answers1

2

Assuming the filenames are in UTF-8 encoding, in Python 3, this should do:

ftp.encoding = "UTF-8"
print(ftp.nlst())
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992