Quick Macros Forum
FTP Upload - Special characters - Printable Version

+- Quick Macros Forum (http://www.quickmacros.com/forum)
+-- Forum: Support (http://www.quickmacros.com/forum/forumdisplay.php?fid=4)
+--- Forum: General (http://www.quickmacros.com/forum/forumdisplay.php?fid=8)
+--- Thread: FTP Upload - Special characters (/showthread.php?tid=6342)



FTP Upload - Special characters - Extreme - 12-25-2017

Hi !

I have a problem when uploading files to an FTP server that contains "special characters"

For example, if i want to upload a file named "Voici le Maître.jpeg" , it uploads correctly, but when i look in the FTP directory, the file is renamed : "Voici le Ma" , with no file extensions.

Macro testupload
Code:
Ftp f
f.Connect("ftp.server.test" "user" "pwd" 21 0 1)
f.DirSet(F"temp")
f.SetProgressDialog(1 "Progress")
f.FilePut(F"$desktop$\Voici le Maître.jpeg" F"Voici le Maître.jpeg")

Note : If i upload directly from Filezilla, there is no problems

Can you help me ? Thanks Smile


Re: FTP Upload - Special characters - Extreme - 12-25-2017

Update :

Found out the solution by myself :-)
I roamed in the forum and found out what i needed Smile

Just in case :

Macro testupload
Code:
Ftp f
f.Connect("ftp.server.test" "user" "pwd" 21 0 1)
f.DirSet(F"temp")
f.SetProgressDialog(1 "Progress")

str filename="Voici le Maître.jpeg"
filename.ConvertEncoding(CP_ACP CP_UTF8)

f.FilePut(F"$desktop$\Voici le Maître.jpeg" F"{filename}")



Re: FTP Upload - Special characters - Gintaras - 12-25-2017

But this code will stop working if one day you'll check "Unicode" in Options.

replace
filename.ConvertEncoding(CP_ACP CP_UTF8)
with
if(!_unicode) filename.ConvertEncoding(CP_ACP CP_UTF8)
or
filename.ConvertEncoding(_unicode CP_UTF8)