Reputation: 25
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'}
Upvotes: 1
Views: 1038
Reputation: 202393
Assuming the filenames are in UTF-8 encoding, in Python 3, this should do:
ftp.encoding = "UTF-8"
print(ftp.nlst())
Upvotes: 2