I'm trying to upload image file to FTP server and filename has western European character.
file_name = 'müde_Mäuschen'
If I upload this file to FTP it changes letters. File name in FTP becomes müde_Mäuschen
.
Notes:
Code:
from ftplib import FTP
ftp = FTP("Login Details")
path = r'D:\ftp_test'
file_name = 'müde_Mäuschen.jpg'
ftp.storbinary(f"STOR {file_name}", open(path+'\\'+file_name, "rb"))
You need to specify the filesystem encoding of the remote system:
ftp = FTP('Login Details', encoding='cp1252')
Otherwise filenames and directory names will be decoded with the default encoding of the local system.